SX28 assembly code and instructions
i have a problem using the assembly code to update the real-time clock.
So far I've tried putting the value into accumulator and writing data out, or putting out a string and just making the accumulator jump to the needed character in that string. Didn't work so far though. So I'm just wondering how do i implement that real time update with the help of accumulator. My timer variables and the count for them is saved in a bank in memory but it doesn't seem to take it in.
code:
;·mov w, #3
;·call :loop
;
;·mov w, #hour
;·call :loop
;
;·mov w, #min10
;·call :loop
;
;·mov w, #min
;·call :loop
;
;·mov w, #sec10
;·call :loop
;
;·mov global_temp, #sec
;·call :loop
;:loop
;·mov global_temp, #FirstLine
;
;·mov global_temp, global_t
;·mov w, global_temp
;·iread
;·;the character should be in w
;·;save it to see if it was 0
;·mov global_data, w
;·call @writeData
;·call @waitBusy
;·inc w
;·jmp :loop
just seems to put out all zeros into lcd.
the string is
FirstLine
dw '0123456789'
dw 0
any advice??
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My software never has bugs. It just develops random features. lol
So far I've tried putting the value into accumulator and writing data out, or putting out a string and just making the accumulator jump to the needed character in that string. Didn't work so far though. So I'm just wondering how do i implement that real time update with the help of accumulator. My timer variables and the count for them is saved in a bank in memory but it doesn't seem to take it in.
code:
;·mov w, #3
;·call :loop
;
;·mov w, #hour
;·call :loop
;
;·mov w, #min10
;·call :loop
;
;·mov w, #min
;·call :loop
;
;·mov w, #sec10
;·call :loop
;
;·mov global_temp, #sec
;·call :loop
;:loop
;·mov global_temp, #FirstLine
;
;·mov global_temp, global_t
;·mov w, global_temp
;·iread
;·;the character should be in w
;·;save it to see if it was 0
;·mov global_data, w
;·call @writeData
;·call @waitBusy
;·inc w
;·jmp :loop
just seems to put out all zeros into lcd.
the string is
FirstLine
dw '0123456789'
dw 0
any advice??

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My software never has bugs. It just develops random features. lol
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My software never has bugs. It just develops random features. lol
Bean.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
There is a fine line between arrogance and confidence. Make sure you don't cross it...
·
As Bean pointed out, your code has a bunch of assembly warnings that you need to look into. One of the most important is the one that says line #380 has a numeric constant without a "#" in front. In other words, you think you're telling the SX to load the W register with the number $14, but instead you're loading it with the contents located at address $14.
Similarly, the code snippet in your original post has this as the first couple of lines:
Here you load W with the number 3, and then make a call to a routine that displays this on the LCD. I imagine that you want to display the number 3. In ASCII, the number 3 has the value of 51. The original code was written like this:
Note the single quotes surrounding the zero. This tells the assembler that you want the ASCII value of zero loaded into W, not the numeric value.
Where did this code come from? I assume you didn't write it yourself. Are you sure that the LCD is wired up correctly?
Thanks,
PeterM
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My software never has bugs. It just develops random features. lol