Thanks guys for your replies.
Steve,
When I said it worked, I mean it compiles without error, not that it actually produced the correct pattern sequence on the LEDs attached to PORT B. I based this on the example you provided in the post on my troubles with programming the 2550 chip. Your code below produced a nice chase sequence whe programmed into the 16F873A
Code:
ByteA var byte
main:
for bytea=0 to 7
PORTB=DCD BYTEA
PAUSE 250
NEXT
PORTB=255
PAUSE 250
goto main
If I read your code correctly DCD is converting the value of bytea (0 to 7) to binary and then displaying this vaule on port B. ie 1 = 00000001, 2 = 00000010 etc. I was hoping that I could read the pattern string, take the values of each step (0 to 255) and use DCD to display the pattern on port B. Hence
Code:
for bytea=0 to steps
PORTB=DCD patt3
PAUSE D
NEXT
Funny thing is that as I'm typing this I think I know where 'm going wrong. I need to read each value in the sequence. My old code (for the 16F628A) used
Code:
if swcount = 1 then READ (Patt1+counts), PORTB ;read the next value in patt1 and display it on PORTB
if swcount = 2 then READ (Patt2+counts), PORTB
if swcount = 3 then READ (Patt3+counts), PORTB
if swcount = 4 then READ (Patt4+counts), PORTB
if swcount = 5 then READ (Patt5+counts), PORTB
if swcount = 6 then READ (Patt6+counts), PORTB
if swcount = 7 then READ (Patt7+counts), PORTB
So I tried the following (hopefully you will see my logic 
Code:
n = swcount
Pot PORTA.1,scale,D ;used to read value from 10k pot
for bytea=0 to steps
READ (Pattn+bytea), PORTB
PAUSE D
NEXT
goto main
Thinking that it would READ pattern 3 (as I set SWCOUNT to 3 for testing) + the value for bytea (0, to STEPS) and then output it to PORT B. But I get an error "Bad Expression" with the READ (PatN+bytea), PORTB line.
SteveB (and Steve if you can help
)
Would the differences between the two chips that you stated cause the use of the DATA statement be handled differently between the two PICs. The reason I ask was then If I use the code I originally wrote for the 16F628a with the 16F873a, the patterns are not displayed in the same way on the '873a.
Thanks for your help
Bookmarks