What is "level shifting hardware" please? Are you referring to the MAX232 IC ?? Sorry for asking such stupid questions but this is the first time trying to use UART.
I don't know what possible could be wrong. This morning I changed the PIC, changed the MAX232 with ST232 and re build the circuit, but still giving problems
hi,
The 'RS232 serial' levels from a PIC are 0/+5V and are of the opposite 'sense' of the signals the PC serial input expects, ie: +/-9v [ typical]
A Max232 IC is used between the PIC and the PC serial i/o
The 'RS232 serial' levels from a PIC are 0/+5V and are of the opposite 'sense' of the signals the PC serial input expects, ie: +/-9v [ typical]
A Max232 IC is used between the PIC and the PC serial i/o
The way I read the details of the link you posted, suggests that is already fully compatible as a 'RS232 serial' port, so it would expect standard RS232 signals, using a MAX 232 or equivalent.
Do you have a diagram to post of the PIC/MAX232 to PC wiring.?
I was reading on how to set hyper terminal and it looks like it only works with Windows XP. Is that true? because I am using Windows 7 (64bit). Can I use PuTTY instead?
You need to set Hyper terminal to use a direct COM connection... When you plug your USB/RS232 cable, you should get a enumerated port number... ie.. COM7 or something..
Yes!! You can use putty... But the same applies.... Once you configure the virtual com, you can use any terminal software...
Ian Rogers, the coding below is the one you gave me:
Code:
if(PIR1bits.RCIF == 1) // if the USART receive interrupt flag has been set
{
Temp_Instruction = RCREG;
while(!TXSTAbits.TRMT);
TXREG =Temp_Instruction; // echo received data back to sender
}
}
I was following the tutorial in the link below, where it states that PIR1.RCIF must be 1 to indicate that the data is received. Hence, it should be while PIR1.RCIF=0 so it keeps looping till data is received. The received data is then moved to a variable. From that variable it is then moved to TXREG (i.e. before the while(!TXSTAbits.TRMT); ).
He then used while(PIR1.TXIF == 0); to wait for data to be transmitted.
Although I did follow these steps (just in case) it is still not working.
Are the RCREG and TXREG registers cleared automatically when data is received/transmitted ?? or do I have to clear then manually ?
It might be that your cable is being installed as Com-5 or something, have you checked the device manager in windows? Make sure whatever port your cable has been allocated by windows, is the same as you have set in your terminal software
Yes... The RCIF is cleared when the register is read.... The TXIF isn't being used... The reason I don't use it is the TXIF is set BEFORE the TXREG is empty... So I use the TRMT flag, this is cleared when the TXREG is empty, which is what we need..
I have tested the software as posted!!! If you are using C18 and used the OpenUSART(), WriteUSART() and ReadUSART() that they provide, you'll see that the software is okay..
I was reading on how to set hyper terminal and it looks like it only works with Windows XP. Is that true? because I am using Windows 7 (64bit). Can I use PuTTY instead?