unsigned int i;
void main() {
PORTD = 0;
TRISB = 1;
TRISD = 0;
UART1_Init(9600); // initialize USART module
// (8 bit, 9600 baud rate, no parity bit...)
if (PORTB = 0x01 ){ //if push button is unpressed
UART1_Write(0b00001111);
Delay_ms(100);
while (1) {
if (UART1_Data_Ready()) {
i = UART1_Read(); // read the received data
PORTD = i;
Delay_ms(100); //light LEDs on RB0 - RB3
}
}
}
else { //if push button is pressed
UART1_Write(0b11110000);
Delay_ms(100);
while (1) {
if (UART1_Data_Ready()) {
i = UART1_Read(); // read the received data
PORTD = i;
Delay_ms(100); //light LEDs on RB4- RB7
}
}
}
}
hi lloydi12345
here is a sample for u
ur doing library function syntax error
also review some basics of c
yes lloydi12345
it is possible
just u has to use if else statements
when u receive a character compare if it is 'A' then a specific pattern of led on on port
if it is 'B' then another sequence sent to port
hi lloydi12345
here is a sample for u
ur doing library function syntax error
also review some basics of c
how u try thisI tried UART within 1 PIC is working
@ jcwh
before going to wireless u should check it with wire link
once it work with wire it means ur code is ok
then u will be sure that code is ok now problem is in the wireless link
ru using ordinary RF 434 MHz module
it has bad accuracy if u directly connect it with controller
by using decoder with it it has better accuracy
unsigned int i;
void main() {
TRISB = 0b00000010;
PORTD = 0x00;
TRISD = 0x00;
UART1_Init(9600); // initialize USART module
Delay_ms(100); // (8 bit, 9600 baud rate, no parity bit...)
while(1) {
if(PORTB.F1 == 1){ //if push button is unpressed
UART1_Write(0b00001111);
Delay_ms(100);
//while (1) {
if (UART1_Data_Ready()) {
i = UART1_Read(); // read the received data
PORTD = i;
Delay_ms(100); //light LEDs on RB0 - RB3
}
//}
}
else { //if push button is pressed
UART1_Write(0b11110000);
Delay_ms(100);
//while (1) {
if (UART1_Data_Ready()) {
i = UART1_Read(); // read the received data
PORTD = i;
Delay_ms(100); //light LEDs on RB4- RB7
}
//}
}
}
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?