mobo 2pe avr A/D issue

shootershooter Posts: 8
edited 2019-03-15 - 09:11:56 in BASIC Stamp
trying to test AD function, can't get passed waiting for busy to go low. I've got .3vdc waiting at A0.
the code "should" select REF as VDD, my jumper is set for VDD from usb port.

Do I need to provide an "external" VDD ref on one of the Pxx pins?
anyway, the code continually returns a 1 for bsy.
thanks for your time

dave
' {$STAMP BS2pe}
' {$PBASIC 2.5}

'AVR A/D test program
'Rev 1.0
' 3/19 del

'taken from datasheet

owio  CON   10                 ' pin10 = A pin6 = B

V     VAR   Word               ' a/d 10 bit
bsy   VAR   Bit

                              '0 is mode (no reset, byte, lo speed)
                              '00001011 decoded;
                              ' bit 0 & 1 "11" says all 10 bits, in byte size
                              'bit 2 says 0 = VDD ref, 1 says 1.1vdc int ref

                              'bit 3 fixed as 1
                              'bit 4&5 are address 00 = port 0 01 = port 1
main:
OWOUT owio, 0, [%00001011]                              '
DO:

OWIN owio, 4, [bsy]
DEBUG "bsy= ", DEC bsy, CR

 LOOP WHILE bsy
 OWIN owio, 0, [V.HIGHBYTE, v.LOWBYTE]

 DEBUG "value of port 0 = ", v.HIGHBYTE, v.LOWBYTE, CR
'
 GOTO main
If you need petabytes of data, you need to get outside more:)

Comments

  • Your code works on my MoBo. Are you sure you have GPIO3.hex loaded into AVR A? Also, your voltage printout should read:
    DEBUG "value of port 0 = ", DEC v.HIGHBYTE << 8 + v.LOWBYTE, CR
    

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • shootershooter Posts: 8
    edited 2019-03-15 - 09:12:23
    thx for checking.

    I just tried the Dig out and nadda
    here's the code (tried both AVRs) it displays all ports high, so no write.
    I did do a pins check by running wires from daughterboard header to led's and walked through each pin I had access to and they all went hi n lo, no access to the command pins 'cept SW
    btw, is there a better way to post code besides paste'n
    copying correction, thx
    ' {$STAMP BS2pe}
    ' {$PBASIC 2.5}
    
    'AVRfirmeware gpio-3 pg 3
    '
    'test for p0-p3 set low, then hi
    'REV 1.0
    '3/19 del
    
    'set all ports high - HIGH 2,3,7,5
    'cmd AVR "B" to set ports 0-3 low
    'read pins 2,3,7,5
    'cmd AVR "B" to set posts 0-3 high
    'read pins 2,3,7,5
     i    VAR Byte
    
     owio  CON 10     ' "B" avr 6 "A" avr 10
     HIGH   2
     HIGH   3
     HIGH   7
     HIGH   5
     'set ports low
     FOR I = 0 TO 3
     OWOUT  owio, 0, [I << 4 + $04]
     NEXT
     IF IN2 <> 0 THEN GOSUB oops
      IF IN3 <> 0 THEN GOSUB oops
      IF IN7 <> 0 THEN GOSUB oops
     IF IN5 <> 0 THEN GOSUB oops
    
     'set ports high
     FOR I = 0 TO 3
     OWOUT  owio, 0, [I << 4 + $05]
     NEXT
     IF IN2 <> 1 THEN GOSUB oops
      IF IN3 <> 1 THEN GOSUB oops
      IF IN7 <> 1 THEN GOSUB oops
     IF IN5 <> 1 THEN GOSUB oops
    
     DEBUG "yippy", CR
     END
    
     oops:
    
     DEBUG "problem ", DEC IN2, DEC IN3, DEC IN7, DEC IN5, CR
     RETURN
    


    ModEdit: Code tags added
    If you need petabytes of data, you need to get outside more:)
  • forgot, I can read and get REV, was able to load firmware GPIO3
    If you need petabytes of data, you need to get outside more:)
  • shooter wrote:
    btw, is there a better way to post code besides paste'n
    copying correction, thx
    Absolutely! Paste it between [ code ] and [ /code ] tags (without the spaces).

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • got 2 hmc5583L modules, same, comes back with XYZ = -1 weather the module is connected or not, using the sample prg from here hmc5583Demo.bs2.

    so I busted out the scope, got this screen shot for all those that like to stay up late lookin:)
    top = P0 - SDA
    bot = P1 _ SCL

    thanks
    640 x 480 - 95K
    If you need petabytes of data, you need to get outside more:)
  • since I can't access the AVR, I was trying another I2c device, which was sold as HMC5883L, well hours of web'n later, it's a china knockoff! (QMCxxxxx) So they don't break any " I didn't steal it rules", appears they changed Reg maps - still sorting that out, and no, they didn't work. Finally found my old hmc5883l, bought here, ran the canned software and SUCESS!!
    I'm going back to analog, designing n building tube amps :).......
    If you need petabytes of data, you need to get outside more:)
  • Ha! You got stung the same way I did. Read my tale of woe here:

    https://forums.parallax.com/discussion/158176

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. -Antoine de Saint-Exupery
  • Yup, buyer be #%$$^&^'ked.

    I do believe they work from a hardware point, since I'm the only "student" anymore, and I drive a buick, I'm gonna keep plugging.

    I've found breadcrumbs web'n, but where I'm stuck now, the HMCdatasheet states to do a Read or Write, use $3C, $3D followed by internal reg and data ($3C, 02, 00)
    The QMC tells me the internal reg and data, (?? ,$09,$1d), but not what to use for R/W command
    and $3C/D just gets me -1, -1, -1

    Oh the Qmcdatasheet says the internal I2C ID is set for $FF, really creative!!!!!!
    If you need petabytes of data, you need to get outside more:)
Sign In or Register to comment.