Hi guys,
I'm currently working on programming a 68HC11. Here is what I am trying to do.
Imagine 5 LEDS (PB0 - PB4). And, an abitrary number (lets assume 123456789).
Now, imagine that each number is represented by 5 bit binary:
0 - 00000
1 - 00001
2- 00010
3 - 00011
etc.
So, expressed in code:
Now, note at the end of number, I've appended a "#". This is to denote the end of the string. I know how this would work, I'd have the program check to see that the current characters ASCII code (as stored by FCC) is not equal to 23 (hexadecimal).
What I do not understand is how I pick out each particular bit from the "NUMBER" string, and match it to it's binary pattern (obviously I need some form of a loop, and a test to check for what I outlined above, but the exact method is what I do not understand). Obviously then, since the 68HC11 uses memory addressed I/O, it's just a matter of storing the pattern to prb. How would I go about doing this? Any help is appreciated.
I'm currently working on programming a 68HC11. Here is what I am trying to do.
Imagine 5 LEDS (PB0 - PB4). And, an abitrary number (lets assume 123456789).
Now, imagine that each number is represented by 5 bit binary:
0 - 00000
1 - 00001
2- 00010
3 - 00011
etc.
So, expressed in code:
Rich (BB code):
prb equ $1004 Peripheral Port B
ddrb equ $1006 Data direction register B
org $0000
thepattern fcb %00000 pattern 0
fcb %00001 pattern 1
fcb %00010 pattern 2
fcb %00011 pattern 3
fcb %00100 pattern 4
fcb %10101 pattern 5
fcb %00110 pattern 6
fcb %00111 pattern 7
fcb %01000 pattern 8
fcb %01001 pattern 9
NUMBER fcc '123456789#' number with END character
What I do not understand is how I pick out each particular bit from the "NUMBER" string, and match it to it's binary pattern (obviously I need some form of a loop, and a test to check for what I outlined above, but the exact method is what I do not understand). Obviously then, since the 68HC11 uses memory addressed I/O, it's just a matter of storing the pattern to prb. How would I go about doing this? Any help is appreciated.