PDA

View Full Version : RS-232 confusion



Christopher4187
- 15th March 2015, 22:14
This may be a case of a dog chasing his own tail but I'm trying to figure out if what I'm looking at is an RS-232 signal. I've tried various baud rates and it seems to be something around 9600 as that's the most consistent data I can see on the screen. Each piece of data is 500uS. If it's not RS-232, can anyone identify the communication protocol?7739

richard
- 16th March 2015, 07:20
definitely not rs232 and not a Manchester code , its a rtz(return to zero) stream of some sort . where does it come from and is there any identifiable start/stop sequence


bi-phase ?

rsocor01
- 16th March 2015, 11:21
Also, RS-232 signals go from -12V to +12V. What you have there is some kind of 1-wire serial communication going on.

Christopher4187
- 16th March 2015, 21:38
It is one wire communication. The voltage level is 18VDC. What you see in that picture the output from a RS-232 IC. I can identify the start/stop and know what each piece of data is. The problem is, I have to do it with my oscilloscope and eyes as opposed to using a PIC to interpret it.

Each bit is 500uS. The high/low within the 500uS bit is predetermined. In other words, it may be 200uS off and 300uS on or 400uS on and 100uS off but I know before the packets starts. The entire packet is 100mS long.

What is the best way to get this information to a PIC where I can log it instead of staring at my oscilloscope?

richard
- 16th March 2015, 22:01
if you can't identify the device then a complete transaction from line idle to send/receive and back to idle with a data translation would help . guessing seems pointless

Demon
- 16th March 2015, 22:13
If you know it's RS232, why not send into a PC?

Assuming you don't have a Saleae logic probe or other device capable of reading signal.

Robert

Christopher4187
- 16th March 2015, 23:05
If you know it's RS232, why not send into a PC?Richard has confirmed it's not RS-232.
definitely not rs232


if you can't identify the device then a complete transaction from line idle to send/receive and back to idle with a data translation would help . guessing seems pointlessI can identify everything.

I don't really need to convert the data into a "readable" format, all I need to do is accurately measure the on/off period in each bit. For example, if I'm able to do something like this, my job is complete:

Bit 1 // On - 100uS / Off - 400uS
Bit 2 // On - 350uS / Off - 150uS
Bit 3 // On - 100uS / Off - 400uS
Bit 100..........

I'm using an 18F87J50 and tried using an ECCP input but was never able to get it working. Then I figured if it was some type of standard communication I'd be able to push the easy button but that's not a reality now.

Demon
- 16th March 2015, 23:30
I got confused by this I guess.

What you see in that picture the output from a RS-232 IC

If you only want to know ON/OFF duration of 18v signal, why not use the signal to control the base of a transistor that would send 5v to a PIC?

Then I would use interrupts on that pin and use a timer.

Robert

richard
- 16th March 2015, 23:38
getting info here is a bit like pulling teeth , but lets assume a 48mhz clock and that timer4 is free along with a pin like portb .2


some vars
bit_is var byte
I_data var PORTB.2 'lets call this the input

a routine
bit_test:
bit_is =0
t4con=0 ' timer off
tmr4=0 ' clear timer
pir3.3=0 'clear timer overflow flag

while ( ! i_data) : wend 'wait here till input goes high to sync up
while ( i_data) : wend ' wait here till input goes low
t4con=6 ; prescale 16 timer on
while ( ! i_data) : wend ' wait here till input goes high
if pir3.3 then bit_is=1 ; offtime > 340 uS
else
bit_is=0 ' the offtime < 340 uS

endif

return


it could be nicer if
1 does the line idle high or low
2 what does a start bit look like
3 how many bits in a session
4 100uS / Off - 400uS a 1 or a 0 ?

Christopher4187
- 17th March 2015, 01:52
If you only want to know ON/OFF duration of 18v signal, why not use the signal to control the base of a transistor that would send 5v to a PIC?

Then I would use interrupts on that pin and use a timer.I'm a novice when it comes to the timers and interrupts. Seems like a good idea that's worth trying.


1 does the line idle high or low Idles low.


2 what does a start bit look like1ms on/1ms off


3 how many bits in a session100


4 100uS / Off - 400uS a 1 or a 0 ?It's a 1 but it can vary. Before the packet is received, I will know what is a 0 and what is a 1.

richard
- 17th March 2015, 03:29
this should get close to it




define OSC 48
some vars
bits var byte[13] ' an array to hold the 100 bits
I_data var PORTB.2 'lets call this the input
bit_count var byte


'a subroutine
bit_read:
t4con=0 ' timer off
tmr4=0 ' clear timer
bit_count = 0
while ( i_data) : wend ' wait here till input goes idle
while ( ! i_data) : wend 'wait here till input goes high to sync up
t4con=$7e '256:1// count of 45 or so = 1mS
while ( i_data) : wend ' wait here till input goes low
t4con=0 ' timer off
if (tmr4 >43 ) and (tmr4 < 47) then goto start_ok ' bit of latitude might need more
goto bit_read
start_ok:
while bit_count < 100
tmr4=0 ' clear timer
pir3.3=0 'clear timer overflow flag
while ( ! i_data) : wend 'wait here till input goes high
t4con=6 ; prescale 16 timer on
while ( i_data) : wend ' wait here till input goes low
t4con=0 ' timer off
if pir3.3 then bits.0[bit_count]=1 ; ontime > 340 uS
else
bits.0[bit_count]=0 ' the ontime < 340 uS
endif
bit_count=bit_count+1
wend

return

Dave
- 17th March 2015, 15:16
As far as the IDLE high or IDLE low state, looking at the signal with a scope, where is the bus signal level when NO data is being sent? I would imagine it to be high, as most single wire communications use a passive sourced current to stimulate the bus wire (usually a resistor). That way there can be more than 1 device listening as well as more than 1 device able to answer a request. This is done by pulling the line LOW thru an open collector transistor or N channel fet.