Parallel to Serial Assembly software

Status
Not open for further replies.

jpanhalt

Well-Known Member
Most Helpful Member
I have spent considerable time on deciphering the communications of an inclinometer sensor and controller to make a remote indicator. See here: https://www.electro-tech-online.com/threads/serial-communication-protocols.118067/ It is not as simple as first thought.

Time to consider Plan B. Does anyone have a software program in PIC assembly that will convert the 4 bit parallel that goes to an LCD to serial so I can transmit via xBee? I know there are chips for that, but shipping is slow this week. I prefer to use the low-end 12F5XX, but also have some 12F6XX and 16Fxxx chips.

John
 
I'm not familiar with the xBee but I am quite familiar with serial protocols. Does the xBee use some sort of synchronous serial protocol such as SPI or I2C? Or is it an asynchronous serial protocol such as RS-232?
 
The xBee is actually pretty versatile, so I have read. I have only had my pair for a bit over a week. It has a "transparent" mode that basically sends what you send it (asynchronous). I have not gotten into the inner workings of the protocol used. In transparent mode you can set hardware flow control. You can set non-standard baud rates, and I have mine set to 14,400 baud. There is also an API mode that I have not looked into.

But, the xBee is not the issue. The problem I am having is the dialog between the control/display unit and sensor of the inclinometer is not a simple request for data which is answered with data. There are at least two different request codes (probably more, like initialization, steady state, and changed state; 8n1). The response repeats the request and then has at least 3 bytes of data. I have been able to duplicate some of the request and data codes using bit banging. The problem is that when the display sends a request, it must get a response within a certain window or it repeats, and then shuts down or freezes. The xBee's have a significant latency that exceeds that window. I had hoped to solve that with the microcontroller keeping things alive until the data were refreshed.

The three alternatives I am considering are: 1) Transmit only the display data to a local display; 2) Rotate the sensor unit 90° so I can get tilt axis I need and then try to read it from several feet away in bright sunlight (I am using it to help keep pallet forks on a tractor front-end loader level); or 3) Scavenge the sensor and other parts from the inclinometer and start from scratch.

It is for option 1 that I made this post. Taking parallel data into a PIC from an LCD display driver and outputting serial data for wireless transmission seems like something that could be done with polling and bit banging. Before I spent the time to write it, I thought I would ask here whether anyone else had already done it. My programming skills are quite limited.

John
 
Last edited:
As I see it, your problem is you don't have access to the original data, so you're trying to read it from the display LCD - the serial part is absolutely trivial, you need to sort the LCD side out first.
 
Thanks, Nigel. That pretty much sums it up.

I found your RS232 tutorials extremely helpful in writing programs to read, store, and duplicate the serial data -- all 12F509 based. But, the timing and dialog are driving me nuts. So, I figured I would try tapping into the data going to the display. That is where I got lazy. I am assuming others have probably done it many times and would share their code. Unfortunately, my coding ability is limited to Assembly and not too good even at that.

This afternoon, I will start probing around the LCD to see whether I can access the data lines without destroying the unit.

John
 

I've never seen code for doing it - is it a standard LCD text module?, if so the datasheet explains how it's driven.
 
The Lcd is writing 1/2 byte at a time you need to shift in the whole byte then shift that out 8 bits at a time

When RS goes high the LCD is really for data you'll then catch the 4bits shift that in a byte catch next 4 bits then just shift that out.
 
John, I don't have that code for you but I am curious if you know if the LCD is using 4-bit or 8-bit interface mode?
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…