Eric,
This will get you closer - I maintained your logic exactly, which, looks to me, to be a bit troubling as SKIMASK noted. You also will want to get a copy of the 16F870 datasheet to go with the manual. Email back if you want more.
oh, I have not tried this - I do not use PBC anymore ... and you might want to start your project by trying to blink and LED or two rather than trying to code a complete program.Code:;symbol cmcon=$1f ; 16F870 has no comparators and $1f is ADCON0 not CMCON ;poke cmcon,7 ; this line and above not needed for the 18F870 ;symbol adcon0=$9f ; $9F is ADCON1 not ADCON0 – these two lines repeat the next two ;poke adcon0,7 symbol adcon1=$9f poke adcon1,7 ; Make all of PORTA Digital rather than analog Poke, $85, %00000011 ; make pins 0 and 1 on PORTA inputs, the rest outputs Poke, $87, %00000011 ; make pins 0 and 1 on PORTC inputs, the rest outputs Poke $86, %00000000 ; make all of PORTB outputs Poke $05, 0 ; make all outputs of PORTA low Poke $06, 0 ; make all outputs of PORTB low Poke $07, 0 ; make all outputs of PORTC low start: peek 5, B0 ; read PORTA into predefined variable B0 if bit0=0 then A ; if B0.0 = 0 then GOTO A (no gosub in if statement) ReturnFromA: if bit0=1 then D ; if B0.1 = 1 then GOTO D (no gosub in if statement) ReturnFromD: peek 7, B1 ; Read PORTC into B1 if bit8=0 then B ; if B1.0 = 0 then GOTO B ReturnFromB: if bit8=1 then C ; if B1.0 = 1 then GOTO C goto start A: low 6: high 7 ; make PORTB pin 6 low and pin 7 high Goto ReturnFromA B: low 4: high 5 ; make PORTB pin 4 low and pin 5 high ReturnFromB C: low 7 ; make PORTB pin 7 low Goto Start D: low 5 ; make PORTB pin 5 high Goto ReturnFromD END




Bookmarks