Yet it doesnt work right. Im worried it might give me a issue later on. What it does it light led 1 on RA1 then led 2 on RA2 but once it lights led 2 LED 1 turns off.
That's fine, but these can also be done with either
Code:
osccon,IRCF0=1;
osccon,IRCF1=1;
osccon,IRCF2=1;
or
Code:
osccon=0x72;
These can be simplified if you want
Code:
trisa=trisb=0;
porta=portb=0;
And this can be simplified too
Code:
while(1);
Yet it doesnt work right. Im worried it might give me a issue later on. What it does it light led 1 on RA1 then led 2 on RA2 but once it lights led 2 LED 1 turns off.
Not sure. Is this on Junebug? Show me your circuit.
Probably nothing to do with it, but your "porta.1=1" and such should be "lata.1=1". Use the latch/shadow registers instead of the ports and you'll avoid weird problems later.
yeah its pretty wierd but as long as it works. ill be sure to use lata for pic18F from now on. by the way im away from home and am writing this on a psp.
Are you using current limiting resistors on the LEDs? If not, it is possible that the Read/Modify/Write instruction won't work properly using the porta register. Using lata is the preferred method anyway. Which PIC are you using? Some pins are TTL level and others are Schmitt Trigger level pins.
If you want, measure the voltage on the pins driving the LEDs when the LEDs are on. If it is equal or less than 2V, then that was the problem but with the 100Ω resistors it should be above 2V according to the spec sheet.