Hi folks,
I haven't been on this forum for awhile.
I have been trying to use a 20M2 to drive a 7 segment display.
To test it out I used the following program:
'
It is a simple step by step displaying of the numbers 1 to 0.
Unfortunately it doesn't seem to follow the script.
It starts off OK, displaying "1" then "2" but then jumps back to the start to repeat those two digits.
The syntax checks OK, I'm not sure if I have run into a restriction of some sort with the 20M2 chip.
I have tried different 20M2 chips, same result.
I even tried reloading the Editor, in case it had developed a "bug".
Also, using the "Port B" it works OK - just seems to be associated with Port C.
The "experts" on the forum will probably spot the cause but I cannot work it out at the moment.
I am open to any helpful suggestions.
kenmac
I haven't been on this forum for awhile.
I have been trying to use a 20M2 to drive a 7 segment display.
To test it out I used the following program:
Code:
'test_7segment_2.bas
'This program tests the control of a 7 segment display using a Picaxe20M2
'
'Connections:
'c.0 ..... 10K to Segment a
'c.1 ..... 10K to Segment b
'c.2 ..... 10K to Segment c
'c.3 ..... 10K to Segment d
'c.4 ..... 10K to Segment e
'c.5 ..... 10K to Segment f
'c.7 ..... 10K to Segment g
'
' dirsc = %10111111
start:
gosub clearall
gosub units_one 'display "1"
pause 1000
gosub clearall
gosub units_two 'display "2"
pause 1000
gosub clearall
gosub units_three 'display "3"
pause 1000
gosub clearall
gosub units_four 'display "4"
pause 1000
gosub clearall
gosub units_five 'display "5"
pause 1000
gosub clearall
gosub units_six 'display "6"
pause 1000
gosub clearall
gosub units_seven 'display "7"
pause 1000
gosub clearall
gosub units_eight 'display "8"
pause 1000
gosub clearall
gosub units_nine 'display "9"
pause 1000
gosub clearall
gosub units_zero 'display "0"
pause 1000
goto start
'
end
' ##################### Subroutines #################################
'
clearall:
low c.0
low c.1
low c.2
low c.3
low c.4
low c.5
low c.7
return
'
units_one:
high c.1
high c.2
return
'
units_two:
high c.0
high c.1
high c.3
high c.4
high c.7
return
'
units_three:
high c.0
high c.1
high c.2
high c.3
high c.7
return
'
units_four:
high c.1
high c.2
high c.5
high c.7
return
'
units_five:
high c.0
high c.2
high c.3
high c.5
high c.7
return
'
units_six:
high c.0
high c.2
high c.3
high c.4
high c.5
high c.7
return
'
units_seven:
high c.0
high c.1
high c.2
return
'
units_eight:
high c.0
high c.1
high c.2
high c.3
high c.4
high c.5
high c.7
return
'
units_nine:
high c.0
high c.1
high c.2
high c.5
high c.7
return
'
units_zero:
high c.0
high c.1
high c.2
high c.3
high c.4
high c.5
return
It is a simple step by step displaying of the numbers 1 to 0.
Unfortunately it doesn't seem to follow the script.
It starts off OK, displaying "1" then "2" but then jumps back to the start to repeat those two digits.
The syntax checks OK, I'm not sure if I have run into a restriction of some sort with the 20M2 chip.
I have tried different 20M2 chips, same result.
I even tried reloading the Editor, in case it had developed a "bug".
Also, using the "Port B" it works OK - just seems to be associated with Port C.
The "experts" on the forum will probably spot the cause but I cannot work it out at the moment.
I am open to any helpful suggestions.
kenmac
Last edited by a moderator: