Quantcast
Channel: MCS Electronics Forum
Viewing all articles
Browse latest Browse all 20638

BASCOM-AVR : RS232 Communication : NEWTOPIC

$
0
0
I am working on getting data out of a EMS Stinger 4 ECU. Here is a quick explanation. EMS Stinger 4 ECU -> (RS232 to TTL) -> Siphec ATm2561-TB1.2 -> (TTL to TTL) -> EZLCD Touchscreen So here is my problem. I can get the Stinger to start transmitting data using a laptop with RealTerm. The command is 11 00 00 00 00 (hex). I also use a port sniffer to look at this data stream and it looks like this. 111 0.00000251 realterm.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS 112 0.00003380 realterm.exe IRP_MJ_WRITE Serial0 SUCCESS Length 5: 11 00 00 00 00 113 0.00000754 realterm.exe IOCTL_SERIAL_WAIT_ON_MASK Serial0 SUCCESS 114 0.00000391 realterm.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS 115 0.00000447 realterm.exe IRP_MJ_READ Serial0 SUCCESS Length 8: 53 50 31 00 00 00 B8 00 116 0.00000475 realterm.exe IOCTL_SERIAL_GET_MODEMSTATUS Serial0 SUCCESS 117 0.01539190 realterm.exe IOCTL_SERIAL_WAIT_ON_MASK Serial0 SUCCESS I then programmed the AVR with the following code: [code:1:7ea9175c9f]$regfile = "m2561def.dat" $crystal = 16000000 $Baud = 9600 'com to touchscreen $baud1 = 19200 'com to Stinger Open "com1:" For Random As #1 Open "com2:" For Random As #2 Dim Inputstinger1 As Byte Print #1, "Start" 'Print to touchscreen Printbin #2, &h11 ; &h00 ; &h00 ; &h00 ; &h00 ' Start transmitting data from stinger Inputbin #2, Inputstinger1 'Read data from stinger Print #1, "Got Data " ; Inputstinger1 'Print data to touchscreen . . [/code:1:7ea9175c9f] Then I plug the AVR (TTL-RS232) into the same laptop with the same realterm open to check the data stream that I would send to the Stinger and it looks like this: 2540 0.00000559 realterm.exe IOCTL_SERIAL_GET_COMMSTATUS Serial0 SUCCESS 2541 0.00000810 realterm.exe IRP_MJ_READ Serial0 SUCCESS Length 5: 11 00 00 00 00 2542 0.00000587 realterm.exe IOCTL_SERIAL_GET_MODEMSTATUS Serial0 SUCCESS You can see the same data is being sent but I am missing something because somehow it is not communicating with the Stinger. So the main questions: 1. Is there any difference in what a terminal emulator sends as data and what I have coded? 2. Why does the data with the port sniffer look the same but no response from the Stinger? If I can clarify anything please ask. This is one of those really frustrating ones. [b:7ea9175c9f][color=red:7ea9175c9f](BASCOM-AVR version : 1.11.8.7 , Latest : 2.0.7.6 )[/b:7ea9175c9f][/color:7ea9175c9f]

Viewing all articles
Browse latest Browse all 20638

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>