rgc
Junior Member level 1
I'm an absolute begginer to Hi-Tech C compilers, and I can't get the following code to work. It should be ridiculously simple, if I turn RB0 high A0-7 will turn high, and vice versa, but somehow I managed to get it wrong. It doesnt matter RB0's state, nothing changes on LATA which will always be low.
Some info:
- I'm using HTC version 9.80 for PIC18
- I am using a crystal resonator of 20 MHz
- My circuit is correct.
What am I doing wrong?
Some info:
- I'm using HTC version 9.80 for PIC18
- I am using a crystal resonator of 20 MHz
- My circuit is correct.
Code:
#include <htc.h>
#pragma config FOSC = HS
#pragma config PWRT = OFF
#pragma config BOR = OFF
int main(void){
TRISA = 0x00;
TRISB = 0xFF;
while(1){
LATA=RB0?0xFF:0x00;
}
}
What am I doing wrong?