Shop OBEX P1 Docs P2 Docs Learn Events
DS1307 on an SX28 PDB (working) vs SX48 protoboard (not working) — Parallax Forums

DS1307 on an SX28 PDB (working) vs SX48 protoboard (not working)

T&E EngineerT&E Engineer Posts: 1,396
edited 2009-11-03 23:23 in General Discussion
I took JonnyMacs DS1307 code and just modified the DEVICE line for an SX48 vs the default SX28. See attached.

I can get the DS1307 code to run fine on my PDB with an SX28 to Hyperterminal 38400. However, if I run the TX, RX, SCL and SCA from the PDB to RA on an SX48 protoboard, sometimes I get strange chars on Hyperterminal and sometimes nothing at all happens. I first thought it was a Baud issue but lowering it down to 19200 and 9600 had no effect.

I also ran a ground wire from the PDB to VSS on the SX48 protoboard. I also used a 4 MHz resonator.

Is there anything else uniquely different between the SX28 and SX48 that I am not seeing here?

Thanks.

Comments

  • Sens-a-DatSens-a-Dat Posts: 44
    edited 2009-11-03 23:23
    Personally with the SX48, I have had difficulty getting the PIN assignment commands to work and ended up using an initialize routine to set the port settings. An example from one of my programs is below. Maybe doing a similar thing for your program will resolve the issue.

    ASM
      MODE $09                ; WKPND_B
      MOV !RB,#00000000B      ; clear pending Port B detections
    
    
      MODE $0A                ; WKED_B
                              ; 0 = selects rising  edge detection
                              ; 1 = selects falling edge detection
      MOV !RB,#11111111B      ; set high-to-low detection for all Port B pins
    
    
      MODE $0B                ; WKEN_B
                              ; 0 =  enable pin for interrupt
                              ; 1 = disable pin for interrupt
      MOV !RB,#11111111B      ; 
    
    
      MODE $0C                ; ST_B/C/D/E
                              ; 0 =  enable Schmitt Trigger
                              ; 1 = disable Schmitt Trigger
      MOV !RB,#11111111B    
      MOV !RC,#00000001B     ; enable 1-7 as Schmitt-Trigger
      MOV !RD,#00000000B     ; enable all inputs as Schmitt-Trigger
      MOV !RE,#00000000B     ; enable all inputs as Schmitt-Trigger
    
    
      MODE $0D                ; LVL_A/B/C/D/E
                              ; 0 = Sets pin to CMOS
                              ; 1 = Sets pin to TTL
      MOV !RA,#    1111B       ; set 1-3 inputs to TTL levels
      MOV !RB,#11111111B    ; set 1-5,7 inputs to TTL levels, 6 to CMOS
      MOV !RC,#11111110B    ; set 1-7 inputs to TTL levels, 0 to CMOS
      MOV !RD,#11111111B    ; set all inputs to TTL levels
      MOV !RE,#11111111B    ; set all inputs to TTL levels
    
    
      MODE $0E                ; PLP_A/B/C/D/E
                              ; 0 =  Enable internal pull-up resistor
                              ; 1 = Disable internal pull-up resistor
      MOV !RA,#    0000B         ; do not use internal weak pull-up resistor
      MOV !RB,#00000000B   ; do not use internal weak pull-up resistor on 0-3 and 6-7
                                         ; internal pull-ups for 4 & 5
      MOV !RC,#00000000B    ; do not use internal weak pull-up resistor
      MOV !RD,#00000000B    ; do not use internal weak pull-up resistor
      MOV !RE,#00000000B    ; do not use internal weak pull-up resistor for 0-6
    
    
      MODE $0F                ; TRIS_A/B/C
                                ; 0 = Sets pin to output mode
                                ; 1 = Sets pin to input (High-Z) mode
      MOV !RA,#    0000B       ; set 0-7 as outputs
      MOV !RB,#11110111B   ; set 0-2 & 4-7 as Hi-Z inputs
                                         ; and pin 3 as output
      MOV !RC,#11111110B    ; set 0 as output, 1-7 as Hi-Z inputs
      MOV !RD,#11111111B    ; set 0-7 as Hi-Z inputs
      MOV !RE,#11111111B    ; set 0-7 as Hi-Z inputs
    
    
      MOV !OPTION,#01000000B    ; Register $01 is W
                                                    ; RTCC roll-over interrupt off
                                                    ; Prescaler assigned to WDT
                                                    ; Prescaler = 1:1
    
    ENDASM
    
Sign In or Register to comment.