Shop OBEX P1 Docs P2 Docs Learn Events
Rookie SX/B question — Parallax Forums

Rookie SX/B question

les_blueles_blue Posts: 15
edited 2006-01-17 21:59 in General Discussion
I am new to the SX/B and my project requires a byte wide output port on port C. When I code this in SX/B, I get a less than optimum output. The code snippet below shows my SX/B vs. ASM for the same function. I would prefer not to inline - Is there a better method or trick that would help?
Thanks

' set port C to 8 bits of output
SXB_code:
output RC.0
output RC.1
output RC.2
output RC.3
output RC.4
output RC.5
output RC.6
output RC.7
SASM_code:
'' inline asm version
\ MOV FSR,#TRIS_C 'output RC.0-RC.7
\ CLR IND ' all outputs
\ MODE $0F
\ MOV !RC,IND
\ BANK $00

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-17 18:06
    You can do the same thing in SX/B:

    · TRIS_C = %00000000

    -- this will make RC.0-RC.7 outputs.· Here's the compiler output:

    ·· 201· 0041· 0CFC······· MOV FSR,#TRIS_C··············· ;· TRIS_C = %00000000
    ······· 0042· 0024
    ·· 202· 0043· 0060······· CLR IND······················
    ·· 203· 0044· 005F······· MODE $0F·····················
    ·· 204· 0045· 0200······· MOV !RC,IND··

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • les_blueles_blue Posts: 15
    edited 2006-01-17 19:12
    Thanks Jon, Thats what I was looking for.
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-01-17 21:59
    There's a page in the SX/B help file on SX aliases that you may find useful.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.