Why this code does not work???
Siri
Posts: 220
I am trying to display output from a serial device - which sends out 2 bytes of data.The device works well and when the out put is captured using BS2sx works ok.
When I use the propeller - "PropRPM" the attached code only displays "Display O2 sat data in ASCII" text only.
NO serial data is displayed at all.
Please can someone show me why?
Thanks
When I use the propeller - "PropRPM" the attached code only displays "Display O2 sat data in ASCII" text only.
NO serial data is displayed at all.
Please can someone show me why?
Thanks
doc
22K
Comments
You might try changing:
RxData1 := BS2.SERIN_DEC(RX_Pin,Baud,1, 8)
to
RxData1 := BS2.SERIN_DEC(RX_Pin,Baud,0, 8)
just in case you signal is inverted somewhere...
also, for troubleshooting, maybe try
RxData1 := 5
and be sure it shows "5" on the monitor.
You might consider using "fullduplexserial" instead of BS2 functions if you still have problems. It's also pretty easy to use.
·I tried using "·RxData1 =5" ,"Rxdata2=10" and I can display the numbers on the screen.
I also used "FullDuPlexSerial",:ExtDuplexSerial","Simple Serial" - objects. with all of them do·NOT seem to receive any serial data.
I am using the"PropRPM" with the built in serial interface using the "MX2232" chip.
The Basic Stamp set-up I am using the serial data is sent directly from the serial device to the BS2px ·pin using "SERIN command".
Does this have antthing to do with this problem.
Can I use a 10K resistor and directly feed the serial out put from the serial device to the "Prop Pin-31" as I only require the serial out-put from the serial device.
Thanks for the quick reply.
Siri
P.S - serial device still works well with BS2 set-up.
I am connecting the DB9 connection from the serial device to the DB9 in the "PropRPM".
I have nothing else connected.
Rayman - I will try your solution.Is there a way to·check the out-put with a Digital voltmeter to
see whether it is TTL or not.
Thanks
Siri
Measure the voltage at the output. If the resting or idle voltage is +5V, it's probably TTL.
Thank you very,very much for such prompt replies.You all are agreat help for week-end amature electronic hackers like me who has no formal training.
I will try what both of suggested and will post back with the results.
Thanks again.
Siri
The voltage between pin-2(Rx) and pin-5(gnd) of the DB-9 is 8.7V. coming from the serial device.
Please advise.
Thanks,
Siri
I measured again - the measurements are very confusing anyway here they are :
····· 1.DB-9 pin2(Tx)· and pin 5-Gnd --->8.7V ----> This is Tx coming out of BS2 pin
····· 2DB-9 pin3 (Rx) and pin5(Gng) --->0.001V ---> this is the Rx going to the BS2 pin
I measured them after removing the BS2px chip - measured at the DIP socket
I am very confused now.
Please advise.
Thanks
Siri
So, I guess I don't know why your original code didn't work...
Post Edited (Rayman) : 4/30/2008 3:39:34 AM GMT
I connected the serial out-put straight to the computer and then tried to capture the data via the Hyperterminal and I get all garbage and NO decimal out-put.The connection parameters are correct - "9600,8,N,1 " as stated in the instructions with the serial device.
When I fired up the software that came with it - I get decimal out-put as it is supposed to - which I also get from my BS2px st-up.
Then I used RS232 port analyzer software - which also worked well and diaplayed the decimal out-put correctly.
As far as I can see the hardware is connected OK.Only the·?" PropRPM" and ? Hyperterminal has issues.
I hope one of you can solve this.
Thanks again
Siri
It may be that the decimal output you're looking for would look like junk on the Hyperterminal screen.· But, at least you get some output from your device with Hyperterminal.· You should get something with your setup too...
Maybe there's something strange about the PropRPM platform...· I'm not too familiar with that...
·Thanks for helping me.
Please find the attached specs for the serial device.
Siri
It is attaced to the DB9 via - chpi # LTC1382CSW.
I have attached the data sheet for you.
Thanks for all this.
Siri
I just received the "Parallax USB Scope" and was just reading the intro., so you can see I am very,very
fresh at this.
If you can just point me what I should do with the scope I will be glad to follow your instructions.This will not only solve the problem but will also be a very good lesson in oscilloscope usage.
Thanks
Siri
I guess you should get 3 bytes like this every second...
I think the high level should be 10V and the low level might be 0 or -10V...
Then, hook it up to your PropRPM and look at pin31.· You should see the same type of signal with a high voltage of about 3.3V and a low voltage of 0V...
It needs to be on pin3 of the DB9 connector, but maybe it's on pin2 for some reason... If so, need a null-modem like adapter to swap pins 2&3...
Measring the out-put from the serial device furhte confused me - may be I was doing it incorrect - with the scope.I seem to get a better signal on P2 rather than P3 - of the DB9 coming out of the serial device.
Then I double checked the connections to BS2 set-up.I have P3 connected and not P2 from the DB9.
Thank you very very much for all the help you have given me.
I will get bak with you when I acquire little experience with the scope so I know what I am doing with it.
If you would like I willget back with you sometime.
Siri
I am planing to connect the serial output directly to the propeller to see if it si gong to work - sine it works with the BS2.
To do so what would be the best way - I know I might damage the prop - that is a chance I am willing to take.
Thanks
Siri
I found this circuit in the forum -" Serial to Propeller Connection Schematic" - may be I will try connecting the serial device as per this doc.
See attachment.
Siri
You might try connecting directly with a 10k resistor. But again, you may have to account for the polarity of the signal.
A simple test that can be done with rs232 is the loopback hookup. Say you want to have hyperterminal receive characters that you type on the keyboard as input .This can be done by connecting the TX to the RX pin which just loops the data back into hyperterminal.
So let's say you want to test your max232 clone circuit . There are two rs232 circuits so you can form a type of loopback test. One rs232 circuit(maybe pins 8and 9) goes to your computer running the software that works and the other rs232 circuit(pins 14 and 15) goes to your device(blood monitor) that your are trying to interface to.
The logic side of the max232clone would have pins 10 and 12 hooked together and pins 11 and 13 would be tied together to form a loopback circuit . This is from the datasheet that you provided.
If the max232 clone is working correctly then you should see the data , if not then your hookup of the chip should be examined closely.
············ I am still unable to capture the serial out-put from the device to the propeller.I tries the transistor circuit using only the the left transistor.I still have to try connecting directly via 10K resistor.In the mean time I have been playing with the scope.
Attached is a picture of the scope wave form and readings.
Thw wave form does not look like the ones in the book· or the one you depicted.
The out put from the device is at 9600,8N1
I can see the out-put at 1.0Htz - frquency.What does all this add upto.
Hoprfully this will give you more info to resolve this issue.
Thanks,
Siri
Since your questions are about all Parallax sold products, you might try calling or emailing their support line... Might get there faster that way...
The serial devise I have is fairly expensive and opening it will void my warrenty and peeping from the openings - the components
seem to be SMD's so I really would not wan't to monkey with it.
Rayman - I will call parallax to-morrow to seek some advise.
Thanks for both of you to taking time to help
Siri
I thought you had made your own interface using the max 232 clone chip and not a manufactured one. Having looked at the Proprpm it already has the max 2323e chip used for·programming the prop. If you can download programs to the Proprpm then you already have your rs232 comm's working.All you really need is to work out your protocol with your device. To test out the rs232 there are several objects that allow you to send from the prop to the PC and vice versa ·thru the rs232. I like Brays terminal as· program which is a free download.
Pete
I can send data from the PC to the PropRPM - I can download the spin code from the PC to the PropRPM.
I can also also see the data out-put from the serial device when connected to the PC - using either using the software that came with the Serial device and also when using a serial port analyser software but not with the Hyperterminal and ·when I connect the derial device to the PropRPM via the serial port - the prop does not see the data.
The spin program seem to working well otherwise except is unable to recive the data - all I can see is "000" and displays other " text" without any problems.NO decimal serial data that show up in the PC when connected directly to the serial device.
I will download the program you suggested and see what happens.
Thanks
Siri