Shop OBEX P1 Docs P2 Docs Learn Events
SX28 to the SX48 — Parallax Forums

SX28 to the SX48

DigitalDjDigitalDj Posts: 207
edited 2009-02-18 02:50 in General Discussion
Hello All,

I want to do some programming on the SX48, what do I need to change that is different than the SX28 when I start off.

Also is USB data 5volts?

Thanks,
Kevin


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Comments

  • BeanBean Posts: 8,129
    edited 2009-02-16 23:33
    Just change SX28 to SX48 on the device line.

    Bean.

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

    ·
  • InSilicoInSilico Posts: 52
    edited 2009-02-16 23:51
    In addition to Bean's post, you also need to make sure you set or clear·the fsr.7 bit·after the bank instruction. This is because of the increased program memory size. The SX48 has twice as much memory as the SX28/20, so this memory is divided·in half·into two blocks, each with its own set of banks. The fsr.7 bit is used to "pick" the upper or lower blocks of the·memory. The SX-Key manual entry for the bank instruction (pg. 124 in my book, Appendix C: SX Instruction Set) tells you more about this.

    Also, on the SX48 you get read/write access to the port configuration registers (the SX28/20 only has write access·to the port config registers), so writing to the mode register is a bit different:
    ; for SX48 mov     w, #literal
    mov     m, w
     
    bank    fr
    setb    fsr.7
     
    ; for SX28/20
    mov     m, #literal
     
    bank    fr
    
    

    The SX-Key manual will tell you about this. The manual also has some macros that can help with this on page 67 (7.4.12)

    Hope this helps!

    Post Edited (InSilico) : 2/17/2009 10:47:43 AM GMT
  • JonnyMacJonnyMac Posts: 9,214
    edited 2009-02-16 23:56
    The brings up an interesting point: This SX/B line:

    MODE = $0F
    


    compiles to

    mov m, #$0F
    


    for both the SX28 and SX48.

    @Bean: Is this an issue?
  • InSilicoInSilico Posts: 52
    edited 2009-02-17 11:00
    @ JonnyMac: Actually, I believe you can get away with mov m, #$0F since the $0F value still "fits" within the instructuion. The mov m, #lit (or mode #lit) instruction has room for a 4 bit value. If the literal is bigger than $0F (meaning >%1111), then one will have to use the mov w, #lit; mov m, w; instruction, because anything bigger than $0F requires more than 4 bits.

    On the SX28/20, any mode value over $0F makes no sense (there's no port config registers beyond that point), so it isn't a problem. On the SX48, though, there are port config registers that extend beyond $0F, so using the mode instruction for those registers is useless, since $0F is bigger than the 4 bit maximum imposed by the mode instruction. Using the mode m, w instruction does not have this limitation.

    Post Edited (InSilico) : 2/17/2009 11:12:19 AM GMT
  • BeanBean Posts: 8,129
    edited 2009-02-17 13:05
    Jon,
    It's okay. The SX28 could save 1 instruction by using "MODE $0F".

    Bean.

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

    ·
  • DigitalDjDigitalDj Posts: 207
    edited 2009-02-18 02:50
    Thanks Guys,

    Some I understand, the other I will learn. I am just doing something pretty simple with the SX48.

    I do have a problem though but I'm sure there is a resolution. I am using 20 of the pins for outputs but I need to have 20 momentary buttons hooked up. Is there a way to detect any of the 20 momentary buttons from 1 pin on the SX. The buttons are hooked up to a interface that replicates buttons on a keyboard. The interface allows me to program the buttons for a certain function etc.

    I want the processor to monitor a usb line to some other lights on my juke and when there is music data through the usb line triggering my light columns the SX48 keeps all pushbutton lights on. When there is no data on the usb line absence of music the SX48 will sequence the lights·on the buttons to prompt you to pick more music. I may also just do it off of the audio out on the sound card because I may have some other issues I just thought of. For now just figure out the button issue.

    I will need to isolate the SX48 circuit from the keyboard interface especially having to hold one of the pins on the SX High until triggered. I thought maybe a diode on each button my do the isolation, what do you guys think?

    Kevin


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔



    Post Edited (DigitalDj) : 2/18/2009 3:07:03 AM GMT
Sign In or Register to comment.