Hi,
I'm using a 18F4550 PIC code that's running on PBP2.50. I'm pulling my hair out trying to figure out why this code won't work.
PORTA.0 stays low and never changes to high. However, if I do the following, then the code works and I get both ports high.Code:DUMMYVAR VAR BYTE TRISB = %00000000 'SET ALL B PORTS AS OUTPUTS ADCON1 = %00001111 'SET ALL PORTS TO DIGITAL MAIN: PORTA.0 = 1 PORTA.1 = 1 DO SOME STUFF...... GOTO MAIN
So, why does the second code works and the first one doesn't? Do you need a pause or delay when changing individual port settings in the same port bank? Does the commands HIGH and LOW resolve this issue?Code:DUMMYVAR VAR BYTE TRISB = %00000000 'SET ALL B PORTS AS OUTPUTS ADCON1 = %00001111 'SET ALL PORTS TO DIGITAL MAIN: DUMMYVAR = 3 PORTA.0 = DUMMYVAR.0 : PORTA.1 = DUMMYVAR.1 DO SOME STUFF...... GOTO MAIN
Thanks,
Robert





Bookmarks