mobo 2pe avr A/D issue
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
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

Comments
-Phil
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 RETURNModEdit: Code tags added
-Phil
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
I'm going back to analog, designing n building tube amps
https://forums.parallax.com/discussion/158176
-Phil
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!!!!!!