If you connect PIC directly or via resistors to PC, 7 bits are sent only.
Add Max232 or MAX3232 type of RS232 chip in between the PIC and the PC.
If you connect PIC directly or via resistors to PC, 7 bits are sent only.
Add Max232 or MAX3232 type of RS232 chip in between the PIC and the PC.
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Take the PC out of the loop you're just introducing more variables, your LA is all you need.
A couple of things to check, is the Fosc (the clock running the PIC, not necesarily the crystal) you tell the compiler is the same as the actual? Is the signal inverted?
Use your LA to decode the signals and look at the polarity? Let the LA determine the baud rate or calculate the bit time at 2400 and measure it on the LA.
George
I should have elaborated more on the PC part; I moved to sending bytes via PC as a direct result of this issue. The PIC in question is actually supposed to be talking to another device via serial - I need to send a byte to this device to query it and then it responds with a few bytes I need to capture. I can successfully send the byte to the device and the PIC captures the correct amount of bytes in return but it just captures the "wrong" bytes. I changed my code on the PIC to look for these "wrong" bytes and it actually functions but this is quite a hack and I'd like to sort out why it's not reading them properly in the first place.
I put together the simple code above and connected to the FTDI on my computer to be able to quickly test the result of sending various bytes to the PIC to see their result. The bytes my PC send are interpreted by the PIC the same as the bytes the other device was sending (e.g. device/PC sends 0x0A [confirmed w/ LA] but PIC sees 0x3D)
The RX signal is not inverted. The device is listening for an inverted signal to start but that's on the TX side which is passed through an inverter. The TX from the PIC is successfully received by the device and the device's response (not inverted) does not function.
Confirming the baud with the logic analyzer is a good idea; I'll have to do that and report the value. I believe I did have it set to "autobaud" when I first tested and it was something like 2389 or slightly off from 2400 baud but I will confirm again to be sure.
just tried your code on a 16f648a , works perfectly from my pc usb through tty converter to pic , you must have polarity of signal screwed up.
Warning I'm not a teacher
The difference between 2389 and 2400 would not seem a big deal, it only 0.5% (if my maths right, which is unlikely)
George
I traced out the board and realized another component sitting between the board input and PIC was inverting the signal. The board is being re-purposed from a different use so I was able to bypass that and everything is working as expected. Thanks
Bookmarks