Hi all,
Back after an absence of a few months. I'm still building my alarm clock which sprays water, but time is now critical so all help appreciated. The first competition is less than 2 weeks away - would be awesome if the Picaxe could take centre stage!
I have an AXE133Y display which (code below) can display my welcome message, plus it has the 18M2 that has a second timer for the clock part.
To make my code easier, I want to use the EEPROM command to set a message and then display that on the LCD.
Here is the code (an extract of the total code) that works for my welcome message. NB All of my code is derived from the Picaxe code or various forum posts:
I would like some help with two problems:
First I want to overwrite an EEPROM value (say $00) with a new string that shows the time. For example
I get this error:
So problem 1 is how do I overwrite data using the EEPROM command (or any other command for that matter!)
Problem 2 is how do I concatenate a string to show the time that I can then write into the EEPROM data ($00) shown in problem 1? I'm pretty sure I can do the necessary maths to be able to extract HH MM and SS from the time variable.
Any help gratefully received.
DDJ
Back after an absence of a few months. I'm still building my alarm clock which sprays water, but time is now critical so all help appreciated. The first competition is less than 2 weeks away - would be awesome if the Picaxe could take centre stage!
I have an AXE133Y display which (code below) can display my welcome message, plus it has the 18M2 that has a second timer for the clock part.
To make my code easier, I want to use the EEPROM command to set a message and then display that on the LCD.
Here is the code (an extract of the total code) that works for my welcome message. NB All of my code is derived from the Picaxe code or various forum posts:
Code:
EEPROM $00, (" WHSG Engineers ") ; store msg in the EEPROM memory
EEPROM $10, ("2012 Alarm Clock") ; store msg in the EEPROM memory
;
gosub LCD_init
;
; display welcome message
low rs ; command mode
let b1 = 0 ; message 0 on top line
gosub msg ; do it
low rs ; command mode
let pinsB = 192 ; move to line 2, instruction 192
pulsout enable,1 ; pulse the enable pin to send data.
high rs ; character mode again
let b1 = 1 ; message 1 on bottom line
gosub msg ; do it
end
;
LCD_init:
; power on LCD initialisation sub routine
let dirsC = %11000111 ; PortC 0,1,2,6,7 all outputs
let dirsB = %11111111 ; PortB all outputs
pause 500 ; Power stabilistation = 500ms
let pinsB = %00111001 ; Function set - select correct character table modes - ; 8 bit, 2 line, 5x8 , Western_European table1
pulsout enable,1 ; flush the instruction to the LED
let pinsB = %00001100 ; Display on, no cursor, no blink
pulsout enable,1
gosub Wipe
return
;
Wipe:
; clear the LCD and prepare for text to display
low rs ; command mode
; Display Clear
let pinsB = %00000001
pulsout enable,1
pause 7 ; Allow 6.2ms to clear display
; Return Home
let pinsB = %00000010
pulsout enable,1
; Entry Mode, ID=1, SH=0
let pinsB = %00000110
pulsout enable,1
high rs ; Leave in character mode
return
;
msg:
; EEPROM start address is 0 to 15 multiplied by 16
let b2 = b1 & %00001111 * line_length
; end address is start address + (line_length - 1)
let b3 = b2 + line_length - 1
; repeat 16 times (once per character)
for b4 = b2 to b3
read b4,b1 ; read next character from EEPROM data memory into b1
let pinsB = b1 ; output the data
pulsout enable,1 ; pulse the enable pin to send data.
next b4 ; next loop
return
First I want to overwrite an EEPROM value (say $00) with a new string that shows the time. For example
Code:
EEPROM $00, ("Something") ; store msg in the EEPROM memory
So problem 1 is how do I overwrite data using the EEPROM command (or any other command for that matter!)
Problem 2 is how do I concatenate a string to show the time that I can then write into the EEPROM data ($00) shown in problem 1? I'm pretty sure I can do the necessary maths to be able to extract HH MM and SS from the time variable.
Code:
EEPROM $01, (" " & <<some sort of command to build a string of values>> & ")"
DDJ