Crazy LCD ....

picnut

New Member
I have a 14M set up to read a pot on pin 0 using ADC. The program is ...


Init: pause 500

Serout 2, N2400, (254,1) 'Clear display
Serout 2, N2400, (254,14) 'Cursor on

Read0:

Pause 30 ' To allow time for display to clear
Serout 2, N2400, (254, 128) 'Move to start of line (1,1)
Pause 30
Readadc10 0, W0 'Read ADC on pin 0
Serout 2, N2400, (W0) 'Print W0 to display 1, 1
Pause 300

Goto Read0

End

The symptoms on the LCD are .... at the lower end of the pot characters change on the LCD in the right place, but are garbage. At the high end of the pot the LCD suddenly starts putting out the sample messages and time !.

It is probably something very simple that I am doing wrong but it is driving me nuts. Thank you .... picnut
 

hippy

Ex-Staff (retired)
A couple of things ...

You probably want a pause after the "Serout 2, N2400, (254,1) 'Clear display"

Add a # to "Serout 2, N2400, (#W0) 'Print W0 to display 1, 1"
 

kevrus

New Member
On my displays, to show the contents of a variable, I use '#' before the variable

try
Serout 2, N2400, (#W0)
 
Last edited:

picnut

New Member
Thanks chaps. The hash sign did the trick, but I have also incorporated the other suggestions as well. No more erroneous messages .... marvelous !. Yes is is the Axe 033 V.2. Thank you all very much. I am trying to get Picaxe into schools for eight year old's and above and am running out of time, due to old age and a general incompetence Hi!.

I also had another weird problem. The board is one I designed for the junior school and to stop them blowing up PIC's I incorporated a octal Darlington ULN 2803A on five of the outputs leaving three unconnected. Occasionally the ULN 2803 latches all outputs together, so whatever output I make high, the other four follow !. The solution was to remove the chip from the circuit and then put it back in .... then everything goes OK again. Next time it happens I think I will have a go at tying down the unused inputs on this chip.

Thank you all ...... John.
 

BeanieBots

Moderator
Interesting, I am aware that is possible to make the ULN2803A latch but only with extreme EMI abuse:eek:

Perhaps post your schematic for us to review.
Tying down unused inputs is always good practice but I fear you may something else going on there.

Does it only happen when you are using inductive loads? eg motors.
What have you done with the clamp-diode connection?
 

westaust55

Moderator
Further to hippy’s comment, as per the AXE033 datasheet pages 7 & 9, there should be a PAUSE of at least 30ms after the Clear screen command before any other commands. Looks like you did that but then put another AXE033 command line between the two.

You will likely find that a short pause eg 10ms is ample after most other control and text to AXE033 commands.

While not used in your code snippet give, but any write commands starting with the value 253 require a 1000ms delay before the next AXE033 command.

So in your code change the first few lines to read:
Code:
Serout 2, N2400, (254,1) 'Clear display
Pause 30 ' To allow time for display to clear
Serout 2, N2400, (254,14) 'Cursor on
Pause 10

Read0:
Serout 2, N2400, (254, 128) 'Move to start of line (1,1)
Pause 10
 

hippy

Ex-Staff (retired)
when do you use sertxd over serout, when using a LCD display?
You normally would not.

Using SERTXD to control a serial LCD can resolve some particular problems ( needing 4800 or 9600 baud ) but introduce others ( downloads will likely corrupt data on the LCD ).
 

BeanieBots

Moderator
Serout is more flexible than sertxd and is usually better for driving LCDs.

The main advantage that sertxd has over serin is that it is available via the download cable when plugged into the programming socket. That makes it very useful as a debugging tool.
 

Snowghost

New Member
thanks guys

looks like il be changing my sertxd lines lol.
may explain the mass amount of "q"s and "p"s coming up on my LCD.



off the top of someones head, what is the reading range of readADC? how many significant figers dose it go to?
 

westaust55

Moderator
To expand upon the information BB has provided:
ReadADC is 8 bit. That's 256 values in the range 0 to a max value of 255.
ReadADC10 is 10 bit. That's 1024 values in the range 0 to a max value of 1023.
 

Snowghost

New Member
i was meaning the uSeconds. but anyway

im having a problem working out what voltage or current is needed to count the microseconds pulse width.

using a sig gen, and a code-less 08M. if i crank it above 2v (pin2) i get rubish on the LCD (pin7)



thanks
 

westaust55

Moderator
Think that you may need to clarify your question as to exactly what you are doing. Maybe even a schematic/sketch

You started with "the reading range of READADC" command

and are now talking about a pulse duration.

The PULSIN command resolution is:
10us at 4MHz clock speed,
5us at 8MHz, and
2.5us at 16MHz.

See PICAXE manual 2 page 135 (in V6.9)
Each interval of that duration will give a count of 1. So at 4MHz clock and a pulse of 30us you get a count of 3.

If you are trying to determine the duration of a pulse, note that Pin2 can be both an analogue input or a digital input. As a digital input is is a Schmidt Trigger so your signal volatge needs to cross the voltage boundary correcty to see high and low states.

As a ST input,
a low is <= 0.2 x Vdd (Vdd = PICAXE supply voltage)
a high >= 0.8 x Vdd
 

BeanieBots

Moderator
im having a problem working out what voltage or current is needed to count the microseconds pulse width.
I'm not surprised. Time is not measured with either volts or amps.

Have a good read of westaust55's post.

using a sig gen, and a code-less 08M. if i crank it above 2v (pin2) i get rubish on the LCD (pin7)
And what did you expect to happen?
If by (pin2) you mean the serin pin (used for programming) then Leg7 (serout) will send an acknowledgement that a new download is about to start every time serin goes high.
This will confuse both the LCD and the PICAXE.

After you have programmed your PICAXE, serin must be held low for it to work.


EDIT:
@Snowghost.
If you are having problems with other commands and inputs to those raised by the original poster, it is much better to start a new thread or great confusion will arise.
 
Last edited:
Top