manual code cut and paste

teemodel

New Member
I copied the lcd simple program code from manual 3 and pasted into a new program. When I run program a rectangular box shows up that contains a yellow triangle with an exclamation point within and another box that says OK. It will not download or give the usual information likes bytes of code etc. Is this not permitted? I have copied and pasted other stuff from the web and it works OK. Thanks in advance for the usual killer help.
 

Chavaquiah

Senior Member
Other than the exclamation point and the OK button, is there any other indication?

Did you try to download a very simple program? One single line would do.

Perhaps the copy-pasting from a PDF inserted some weird character in the text and the compiler may not like it. Please post the code you pasted here (use the [ code ] tags). Someone can run it through another version of the compiler to see if a more meaningful message comes up. Also please state the Picaxe model you're using.
 

hippy

Technical Support
Staff member
It does sound like some unexpected or invalid character has confused the compiler and AXEpad hasn't been able to pickup or display the error message correctly so is not producing a report indicating what that specific error is.

If you can save the source giving problems as a file and post as an attachment we'll see what we can do to investigate the problem. Including in a forum post may not work as that process may change characters as posted or as shown in a browser.
 

teemodel

New Member
Here is the code:

EEPROM 0,(“Hellothere!”) ‘ store the text in the EEPROM memory
gosub init ‘ initialise LCD
main: let b1 = 1 ‘ set b1 to ‘clear display’ instruction
gosub wrins ‘ send instruction to LCD
for b3 = 0 to 4 ‘ setup for...next loop (“Hello” - positions 0 to 4)
read b3, b1 ‘ read letter from EEPROM into variable b1
gosub wrchr ‘ send character to LCD
next b3 ‘ next loop
let b1 = 192 ‘ set b1 to ‘start of second line’ position
gosub wrins ‘ send instruction to LCD
for b3 = 5 to 11 ‘ setup for...next loop (“there!”-positions 5 to 11)
read b3, b1 ‘ read letter from EEPROM memory into variable b1
gosub wrchr ‘ send character to LCD
next b3 ‘ next loop


init: let pins = 0 ‘ Clear all output lines
let b4 = 0 ‘ Reset variable b3
let dirs = 252 ‘ Set pins 2-7 as output lines (Stamp only).
pause 200 ‘ Wait 200 ms for LCD to reset.
let pins = 48 ‘ Set to 8-bit operation.
pulsout 3,1 ‘ Send data by pulsing ‘enable’
pause 10 ‘ Wait 10 ms
pulsout 3,1 ‘ Send data again
pulsout 3,1 ‘ Send data again
let pins = 32 ‘ Set to 4-bit operation.
pulsout 3,1 ‘ Send data.
pulsout 3,1 ‘ Send data again.
let pins = 128 ‘ Set to two line operation
pulsout 3,1 ‘ Send data.
let b1 = 14 ‘ Screen on, cursor on instruction
gosub wrins ‘ Write instruction to LCD
return
wrchr: let pins = b1 & 240 ‘ Mask the high nibble of b1 into b2.
high 2 ‘ Make sure RS is high
pulsout 3,1 ‘ Pulse the enable pin to send data.
let b2 = b1 * 16 ‘ Put low nibble of b1 into b2.
let pins = b2 & 240 ‘ Mask the high nibble of b2
high 2 ‘ Make sure RS is high
pulsout 3,1 ‘ Pulse enable pin to send data.
return
wrins: let pins = b1 & 240 ‘ Mask the high nibble of b1 into b2.
pulsout 3,1 ‘ Pulse the enable pin to send data.
let b2 = b1 * 16 ‘ Put low nibble of b1 into b2.
let pins = b2 & 240 ‘ Mask the high nibble of b2
pulsout 3,1 ‘ Pulse enable pin to send data.
high 2 ‘ Back to character mode
return

Exact copy from manual 3. At least I thought that's what I was doing. Other programs pasted from the web ran fine. Even if I delete all the subroutines it still does the same. In the triangle with the exclamation point there is what looks like a notebook.
 

Chavaquiah

Senior Member
As expected, all the fancy quotes from the PDF are playing havoc with Axepad. Replaced them in the following code. Also, the line "let dirs=252" is supposed to be for the Stamp MCU, so it's better to comment it out.

Try this:
Code:
EEPROM 0,("Hellothere!") ' store the text in the EEPROM memory
 gosub init ' initialise LCD
 main: let b1 = 1 ' set b1 to 'clear displayÕ instruction
 gosub wrins ' send instruction to LCD
 for b3 = 0 to 4 ' setup for...next loop (ÒHelloÓ - positions 0 to 4)
 read b3, b1 ' read letter from EEPROM into variable b1
 gosub wrchr ' send character to LCD
 next b3 ' next loop
 let b1 = 192 ' set b1 to 'start of second lineÕ position
 gosub wrins ' send instruction to LCD
 for b3 = 5 to 11 ' setup for...next loop (Òthere!Ó-positions 5 to 11)
 read b3, b1 ' read letter from EEPROM memory into variable b1
 gosub wrchr ' send character to LCD
 next b3 ' next loop
 
 
 init: let pins = 0 ' Clear all output lines
 let b4 = 0 ' Reset variable b3
' let dirs = 252 ' Set pins 2-7 as output lines (Stamp only).
 pause 200 ' Wait 200 ms for LCD to reset.
 let pins = 48 ' Set to 8-bit operation.
 pulsout 3,1 ' Send data by pulsing 'enableÕ
 pause 10 ' Wait 10 ms
 pulsout 3,1 ' Send data again
 pulsout 3,1 ' Send data again
 let pins = 32 ' Set to 4-bit operation.
 pulsout 3,1 ' Send data.
 pulsout 3,1 ' Send data again.
 let pins = 128 ' Set to two line operation
 pulsout 3,1 ' Send data.
 let b1 = 14 ' Screen on, cursor on instruction
 gosub wrins ' Write instruction to LCD
 return
 wrchr: let pins = b1 & 240 ' Mask the high nibble of b1 into b2.
 high 2 ' Make sure RS is high
 pulsout 3,1 ' Pulse the enable pin to send data.
 let b2 = b1 * 16 ' Put low nibble of b1 into b2.
 let pins = b2 & 240 ' Mask the high nibble of b2
 high 2 ' Make sure RS is high
 pulsout 3,1 ' Pulse enable pin to send data.
 return
 wrins: let pins = b1 & 240 ' Mask the high nibble of b1 into b2.
 pulsout 3,1 ' Pulse the enable pin to send data.
 let b2 = b1 * 16 ' Put low nibble of b1 into b2.
 let pins = b2 & 240 ' Mask the high nibble of b2
 pulsout 3,1 ' Pulse enable pin to send data.
 high 2 ' Back to character mode
 return
 

teemodel

New Member
Chavaquiah & Hippy

Copied and pasted the code Chavaquiah sent and it worked like a charm. So in the future forget about c & p with PDF files unless there is some easy way to get rid of the extra marks? Thanks a lot, guys.
Teemodel
 
Top