Shop OBEX P1 Docs P2 Docs Learn Events
SX28 assembly code and instructions — Parallax Forums

SX28 assembly code and instructions

newbie@SRCnewbie@SRC Posts: 3
edited 2009-03-04 18:12 in General Discussion
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??smhair.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My software never has bugs. It just develops random features. lol

Comments

  • JonnyMacJonnyMac Posts: 9,412
    edited 2009-03-04 16:52
    Not being a full-time Assembly programmer I'm confused... you seem to be passing an address to a register but not a value for it. It would probably help others help you if you attached the full listing.
  • newbie@SRCnewbie@SRC Posts: 3
    edited 2009-03-04 17:14
    ok this is the code so far, just messing with the lcd now, but what i need is to put out whatever is saved in sec, sec10 etc... onto the LCD.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My software never has bugs. It just develops random features. lol
  • BeanBean Posts: 8,129
    edited 2009-03-04 17:30
    Your file does not compile. "dec" is not a valid WATCH type. Changing to UDEC, the file generates alot of warnings. These are probably the problem.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There is a fine line between arrogance and confidence. Make sure you don't cross it...

    ·
  • PJMontyPJMonty Posts: 983
    edited 2009-03-04 18:05
    newbie@SRC,

    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:

    ; mov w, #3
    ; call :loop
    



    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:

    mov w, #'0'
    call :loop
    



    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
  • newbie@SRCnewbie@SRC Posts: 3
    edited 2009-03-04 18:12
    it was compiling before on SX-key v. 2.0.2, but was bringing up lots of errors on v. 3.2.3, and the reason i put in $14 was because i was debugging the code before and wanted to put in the value of seconds that was saved in address 14. I'm trying using the index now and indirect addressing, still have to test it though..· the other problem is the timing,.. was perfect before the display time was put into it.. now it's slow.confused.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    My software never has bugs. It just develops random features. lol
Sign In or Register to comment.