blueroomelectronics
Well-Known Member
Well it's beta but I always enjoy sharing ideas and always fun to have food for thought.
This code snippet will be in the next issue of JPUG but I thought I'd share it here for review.
It uses the debug pins and USART pins and I'll write a routine to show the status on the Junebugs LEDs.
It also depends on the 4.7K pulldowns on DIP switch switches 2,3,4,5 and the Junebug programmer normally floats PGC & PGD after programming.
D = RB.7
C = RB.6
B = RB.1
A = RB.4
Note: one of the really neat features the 18F have over the 16F is W is also a register (WREG)...
This code snippet will be in the next issue of JPUG but I thought I'd share it here for review.
It uses the debug pins and USART pins and I'll write a routine to show the status on the Junebugs LEDs.
It also depends on the 4.7K pulldowns on DIP switch switches 2,3,4,5 and the Junebug programmer normally floats PGC & PGD after programming.
Code:
bcf INTCON,RBIF ; enable weak pullups on PORTB
GetDIP movf PORTB,W ; DCxAxxBx
andlw b'11010010' ; DC0A00B0 (mask)
btfsc WREG,1 ; is B zero?
bsf WREG,5 ; DCBA00B0
swapf WREG ; 00B0DCBA
andlw 0x0F ; 0000DCBA
C = RB.6
B = RB.1
A = RB.4
Note: one of the really neat features the 18F have over the 16F is W is also a register (WREG)...
Last edited: