Display problems with 24a
-
- Posts: 10
- Joined: 01 February 2010, 16:35 PM
Display problems with 24a
I'm New Here and have a problem that I'm not sure I can even explain. I am using a zx24a and a parallax serial 2 X 16 display. I started writing code for a project. I would do a module, test, and move on to the next.The display always did what I needed, with no problems. After all the modules were tested and running I started building the final code. Every thing was going well. Getting to the end I found that sometimes the display would not initialize when the new code was loaded or when power was cycled.
NOW.
After many many hours, I found that if I used more than 4 modules that use ADC, the display would fail. I finished the program and every thing worked except the display. I found if I disabled any 3 of the routines that used ACDs the display worked great. And I mean ANY 3 of the 7 ADCs being used. All the other code works as best as I have been able to tell so far.
Could anyone tell me why using more than 4 ADC would cause the LCD to not reset correctly? It is as if part of the LCD code is being overwritten or something. When this happens , resets, power cycles or re downloading doesn't help. Any Thoughts, )Please.
Thanks, Paul
NOW.
After many many hours, I found that if I used more than 4 modules that use ADC, the display would fail. I finished the program and every thing worked except the display. I found if I disabled any 3 of the routines that used ACDs the display worked great. And I mean ANY 3 of the 7 ADCs being used. All the other code works as best as I have been able to tell so far.
Could anyone tell me why using more than 4 ADC would cause the LCD to not reset correctly? It is as if part of the LCD code is being overwritten or something. When this happens , resets, power cycles or re downloading doesn't help. Any Thoughts, )Please.
Thanks, Paul
Re: Display problems with 24a
The only conjecture that I have is that the ADC usage somehow is interfering with the serial transmission. Are you using one of the software UART channels (Com3 to Com6) for the LCD serial I/O? Even if that were confirmed to be true, determining why it happens without seeing the source code would be nearly impossible. If you don't want to post the project code you can put it in an archive (e.g. .zip) and send it to me.pmckechnie wrote:Could anyone tell me why using more than 4 ADC would cause the LCD to not reset correctly?
- Don Kinzer
-
- Posts: 10
- Joined: 01 February 2010, 16:35 PM
Thanks for the response. Yes, I am using com 3 and it works fine in all other programs I have used. I am going to attach the file here if possible.
Do fall out of your chair when you see it. Thanks, Paul
Do fall out of your chair when you see it. Thanks, Paul
- Attachments
-
- MPGComputer.bas
- (15.37 KiB) Downloaded 2256 times
Last edited by pmckechnie on 07 June 2010, 4:02 AM, edited 1 time in total.
-
- Posts: 10
- Joined: 01 February 2010, 16:35 PM
Anyone can edit their own posts. To do so, click the Edit button associated with a particular post and you'll get a web page similar to the one used originally to make the post. Near the bottom, you'll find the attachments section which includes, for each attachment, a "Delete this Attachment" button.pmckechnie wrote:I would delete the old one from the forum if I knew how.
- Don Kinzer
-
- Posts: 10
- Joined: 01 February 2010, 16:35 PM
Don
I jumped the gun when I started this thread. I didn't think it through enough and made a lot of mistakes like the wrong programs, etc.
Well, here is one that is cleaner an will describe the problem a little better.
If you look at lines 123 - 137 you will see most of the lines commented out. The lines to the left are the ADC lines. MAF and OIL are commented out (it doesn't matter which 2 are commented out). I have disconnected all circuitry except the display. The 24a is on a parallax Super Carrier Board and using a 12V 1.25A wall wort(sp) for power. The display will not reset (clear the screen, back light on, no cursor) when I cycle the power off and then on. If I comment any one of the other calls to an ADC function, the display will work fine. Always resets on power up or reset.
I'm sorry for being so confused but I am getting OLD (on Medicare) and doing this project just to prove to myself I can still do it. I have tried with out asking for help but everyone needs help at some time.
Thanks again for any help.
Paul
I jumped the gun when I started this thread. I didn't think it through enough and made a lot of mistakes like the wrong programs, etc.
Well, here is one that is cleaner an will describe the problem a little better.
If you look at lines 123 - 137 you will see most of the lines commented out. The lines to the left are the ADC lines. MAF and OIL are commented out (it doesn't matter which 2 are commented out). I have disconnected all circuitry except the display. The 24a is on a parallax Super Carrier Board and using a 12V 1.25A wall wort(sp) for power. The display will not reset (clear the screen, back light on, no cursor) when I cycle the power off and then on. If I comment any one of the other calls to an ADC function, the display will work fine. Always resets on power up or reset.
I'm sorry for being so confused but I am getting OLD (on Medicare) and doing this project just to prove to myself I can still do it. I have tried with out asking for help but everyone needs help at some time.
Thanks again for any help.
Paul
- Attachments
-
- MPGComputer[1].bas
- (14.6 KiB) Downloaded 2314 times
I don't have a Parallax 2x16 Serial LCD so I made a few changes to the code to make it compatible with a 2x16 LCD that I do have. This really only required changing some of the command codes and changing the way that the cursor position is set (e.g. at lines 251 and 280). By the way, it would be considered good style to add a routine for setting the row/column, e.g. Sub LCDSetPos(ByVal Byte as row, ByVal col as Byte). That makes it much simpler to change the code to operate on a different display. The same can be done for the other LCD interaction routines.pmckechnie wrote:If you look at lines 123 - 137 you will see most of the lines commented out.
Next, I replaced the lines 22 and 23 with this code:
Code: Select all
KB = 1
Do 'Start:
'Call GetKB
Code: Select all
Call Delay(2.0)
KB = KB + 1
If (KB > 6) Then
KB = 1
End If
Loop 'goto Start:
When I compile and run this code, the display nicely cycles through the various data elements. It also works correctly from both reset and power-on.
What version of the ZX-24a VM do you have? It should display in the IDE's output window when the application begins running.
Note that line 89 is not necessary (neither is it harmful). When Com3 is initialized the transmit pin will automatically be set to the correct logic level.
- Don Kinzer
-
- Posts: 10
- Joined: 01 February 2010, 16:35 PM
Don
I made the changes you mentioned and I still have the same problem. I have VM version 3.0.4 and IDE version 3.0.4. I have been playing with it some more tonight and it seem that with all or most of the Call lines active, the display code is some way gets lost or over written. The display actually displays the data correctly but the back light will be off and there will be a cursor at line 2 pos 1. I found that if I just disconnect the display and reconnect it, it will do the same (data, but no back light and the cursor on. Now when I have enough of the Calls working , then cycle the power I get the data, but no back light, and the cursor on. Remove one or more Calls and the Display works correctly (Data, Back light, No cursor) after a power cycle, or reset.
Do you have anymore ideas? Maybe I need to upgrade to the new replacement for the 24a? Maybe just admit I can't do this and give up? (no that won't happen) Anyone have any suggestions? I really don't have any idea what to do next.
Thanks Paul
I made the changes you mentioned and I still have the same problem. I have VM version 3.0.4 and IDE version 3.0.4. I have been playing with it some more tonight and it seem that with all or most of the Call lines active, the display code is some way gets lost or over written. The display actually displays the data correctly but the back light will be off and there will be a cursor at line 2 pos 1. I found that if I just disconnect the display and reconnect it, it will do the same (data, but no back light and the cursor on. Now when I have enough of the Calls working , then cycle the power I get the data, but no back light, and the cursor on. Remove one or more Calls and the Display works correctly (Data, Back light, No cursor) after a power cycle, or reset.
Do you have anymore ideas? Maybe I need to upgrade to the new replacement for the 24a? Maybe just admit I can't do this and give up? (no that won't happen) Anyone have any suggestions? I really don't have any idea what to do next.
Thanks Paul
A technique that may be helpful is to monitor the output to the display so you can get an idea of what is getting sent. Perhaps the easiest way to monitor the serial output is to wire up an RS-232 level converter (e.g. MAX232) on a breadboard and outfit it with a DB-9 connector. (If you don't have a MAX232 or equivalent, you could use an inverter like the 74HC04.) Then, you can connect a serial port on a PC to the DB-9 and run a terminal emulator that supports data logging. This will allow you to collect the data for further analysis.pmckechnie wrote:I really don't have any idea what to do next.
If you have a second microcontroller (Basic Stamp, BX-24, ZX-24, etc), you could also use it to do the serial monitoring.
Although probably not related to the issue at hand, I have some observations about the excerpt from DisplayVoltFuel() shown below; similar sequences appear twice in each of the several display routines.
Code: Select all
Call PutQueueByte(OutQue,&H80)
tx="Volt "
Call PutQueueStr(OutQue,tx)
c=len (cstr(Volt)) 'This is the fill-in code
c=8-c
tx = spaces(c) & cstr(Volt)
Call PutQueueStr(OutQue,tx)
Call Delay (0.01)
Code: Select all
'
'' DspCaptionAndValue()
'
' Output a caption string and a value string to the LCD
' with the former left-adjusted and the latter right-adjusted
' in their respective field widths.
'
Sub DspCaptionAndValue(ByVal captionStr as String, ByVal valueStr as String)
Const CaptionFieldWidth as Integer = 8
Const ValueFieldWidth as Integer = 8
Dim strLen as Integer
Dim fillLen as Integer
' output the caption string
Call PutQueueStr(OutQue, captionStr)
' determine the number of spaces of fill needed
fillLen = 0
strLen = Len(captionStr)
If (CaptionFieldWidth > strLen) Then
fillLen = fillLen + CaptionFieldWidth - strLen
End If
strLen = Len(valueStr)
If (ValueFieldWidth > strLen) Then
fillLen = fillLen + ValueFieldWidth - strLen
End If
' output the fill
Do While (fillLen > 0)
Call PutQueueByte(OutQue, Asc(" "))
fillLen = fillLen - 1
Loop
' output the value string
Call PutQueueStr(OutQue, valueStr)
End Sub
Code: Select all
PutQueueByte(OutQue,&H80)
Call DspCaptionAndValue("Volt", CStr(volt))
- Don Kinzer
-
- Posts: 10
- Joined: 01 February 2010, 16:35 PM
Don
Thank you VERY much for the programing suggestions, they will be in the program soon. Now to the other suggestion of using another computer or something to monitor the display data line. I got out my old digital scope and took a look and I could see each byte going to the display. If course I couldn't decode the bytes but I know something was being sent. Well I was playing around with delays between bytes so they displayed betteron the scope. I put characters between the set up code bytes, etc and low an behold it started working perfect, well except it was putting extra characters on the display but they went away as soon as the first display routine run. I can't explain what difference any of this makes but it must be some kind of timing issue with the display. As for now, I am a happy camper. The extra delays I put in are not an issue at all.
Thanks again for the help
Paul
Thank you VERY much for the programing suggestions, they will be in the program soon. Now to the other suggestion of using another computer or something to monitor the display data line. I got out my old digital scope and took a look and I could see each byte going to the display. If course I couldn't decode the bytes but I know something was being sent. Well I was playing around with delays between bytes so they displayed betteron the scope. I put characters between the set up code bytes, etc and low an behold it started working perfect, well except it was putting extra characters on the display but they went away as soon as the first display routine run. I can't explain what difference any of this makes but it must be some kind of timing issue with the display. As for now, I am a happy camper. The extra delays I put in are not an issue at all.
Thanks again for the help
Paul
One of the differences between serial comms on a ZX and on a Basic Stamp is due to the use of queues in ZBasic. Adding a character to the output queue does not necessarily mean that that character is immediately transmitted (consider, for example, that there may be other characters already in the queue awaiting transmissioin). In contrast, when you invoke SEROUT in a Basic Stamp, the character is immediately transmitted.pmckechnie wrote:I put characters between the set up code bytes, etc and low an behold it started working perfect
The upshot of this is that when the specifications a device indicate that a certain delay is required after a certain command sequence you must write your code so that you know the sequence has been sent before you begin the delay. The StatusCom() function provides a means to determine when all characters that were added to the serial channel's output queue have actually been sent in full. In particular, the &H04 bit of the return value from StatusCom() indicates that the channel has one or more characters that have not yet been fully transmitted. The code below illustrates how to delay until all characters for Com3 have been transmitted.
Code: Select all
Do While CBool(StatusCom(3) And &H04)
Loop
Lastly, you might try adding a 10K pullup resistor to the serial data line. Prior to the serial channel being opened the data out line will be floating and the display may be seeing noise on the line which is affecting it.
- Don Kinzer
-
- Posts: 10
- Joined: 01 February 2010, 16:35 PM
Thanks Don,
I'll play around with this and see what I can come up with. What you are saying about the different way the Parallax and the ZBasic work makes a lot of sense. By putting delays and extra characters in covered up these differences. Also I will add a pull-up resistor just for good measure. That's makes a lot of sense also. I should have thought of that in the design stage, but alas, i didn't.
Paul
I'll play around with this and see what I can come up with. What you are saying about the different way the Parallax and the ZBasic work makes a lot of sense. By putting delays and extra characters in covered up these differences. Also I will add a pull-up resistor just for good measure. That's makes a lot of sense also. I should have thought of that in the design stage, but alas, i didn't.
Paul