tomas
Member level 1
- Joined
- Dec 16, 2012
- Messages
- 41
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,553
Hi, Im using PIC16F877 and transmitter/receiver. but I cant receive signal correctly until my tx level is high. How can I make it low? (In mikroC language)
Receiver Code:
Transmitter Code:
Receiver Code:
Code:
char receive;
void main() {
TRISD = 0x00;
PORTD = 0x00;
UART1_Init(2400);
Delay_ms(100);
while(1) {
PORTD = 0;
Delay_ms(100);
if (UART1_Data_Ready() == 1) {
receive = UART1_Read();
if(receive == 0x01)
{
PORTD.F0 = 1;
PORTD.F2 = 1;
Delay_ms(2000);
}
if(receive == 0x08)
{
PORTD.F1 = 1;
PORTD.F3 = 1;
Delay_ms(2000);
}
if(receive == 0x06)
{
PORTD.F0 = 1;
PORTD.F3 = 1;
Delay_ms(2000);
}
if(receive == 0x05)
{
PORTD.F1 = 1;
PORTD.F2 = 1;
Delay_ms(2000);
}
}}}
Transmitter Code:
Code:
void main() {
TRISB=0xFF;
PORTB=0x00;
UART1_Init(2400);
Delay_ms(100);
while(1) {
if (UART1_Tx_Idle() == 1) {
if (PORTB.RB2==1){
UART1_Write(0x05);
}
if (PORTB.RB3==1){
UART1_Write(0x06);
}
if (PORTB.RB4==1){
UART1_Write(0x01);
}
if (PORTB.RB5==1){
UART1_Write(0x08);
}
}
}}