Shop OBEX P1 Docs P2 Docs Learn Events
Problem with MAX186 and BS2p — Parallax Forums

Problem with MAX186 and BS2p

CMCM Posts: 7
edited 2007-12-19 21:11 in BASIC Stamp
Hello
I have started with the Basic stamp education board and am trying to interface a MAX186 with a temp sensor (LM35) and send the data to·my BS2p. I·am having problem.·The result is 0 V even if I measure 240mV on the corresponding input on the MAX186.
·
I have followed the recommendation regarding Interfacing the MAX186 8 Channel ADC to the BSII to measure voltages at Shaun´s basic stamp page. I have tried to exchange the MAX186 with a new one and also transferred from breadboard connections to a soldered PCB interface for the MAX186. The problem still is the same, 0 V.
·
I have also simulated the code in ISIS and see that the code timing seems to be OK when compared to the requirements in the MAX186 datasheet, please see attachment "Analyser overview.bmp" "Analyser shift out.bmp" and "Analyser shift in.bmp".
·
Could the reason be that it is the BS2p instead of a "slower" BS2??···If any one could help me I would appreciate it.


Best Regards

Christer


If I measure the MAX186 with the multimeter:
VREF (PIN11):············ 4.1V
REFADJ (PIN12):········ 2.43V
LM35 Channel (PIN6): 240mV



The BS2p Code is:
' =========================================================================
'
'·· {$STAMP BS2p}
'·· {$PBASIC 2.5}
'
' =========================================================================

'
[noparse][[/noparse] Program Description ]


'
[noparse][[/noparse] Revision History ]


'
[noparse][[/noparse] I/O Definitions ]


'
[noparse][[/noparse] Constants ]

·

'*******ADC omvandlare nedan
cs········· CON· 1· 'enable or disable A to D converter
serDo···· CON· 2· 'serial data out p2
serDin··· CON· 3· 'serial data in p3
serclk···· CON· 4· 'serial Clock p4
'********ADC omvandlare (expletive)
'
[noparse][[/noparse] Variables ]

'*******ADC omvandlare nedan
Channel· VAR· Nib· 'set channel to 0 for if your using CH0. 1 if your using Ch1 and so on.
Chsel·· ·· VAR· Byte· 'channel select
ADCin··· VAR· Word· 'ADC reading
i········ ···· VAR· Nib
'********ADC omvandlare (expletive)
·
'
[noparse][[/noparse] EEPROM Data ]


'
[noparse][[/noparse] Initialization ]


'
[noparse][[/noparse] Program Code ]
HIGH· cs········· 'disable ADC
Main:
· DO
· GOSUB chkADC
· LOOP····································· 'main loop
· END
·
'
[noparse][[/noparse] Subroutines ]

·
chkADC:
·FOR i = 0 TO 7· 'read channel 0 to 7
·LOW· cs······· 'enable
·channel =i···· 'set Channel = x, x being a nubmer between 0 to 7 depending on the channel you are using
·LOOKUP channel, [noparse][[/noparse]142, 206,158,222,174,238,190,254],chsel 'tell Adc what channel
·SHIFTOUT serDo, serclk, MSBFIRST,[noparse][[/noparse]chsel]· 'send the channel data
·HIGH cs
·LOW serDo
·LOW cs
·SHIFTIN serDin, serclk,MSBPOST,[noparse][[/noparse]ADCin\12]
·HIGH cs
·DEBUG "Digital out from BS2P= ",BIN chsel, CR
·DEBUG "Channel=", DEC i, "· measures·· ", DEC adcin, " volt", CR
·NEXT
RETURN
·

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2007-12-18 19:09
    Christer,

    The code looks okay and there should be no problem using it with the Stamp 2p. The

    Check the connections again. Agnd and Dgnd both grounded? Shdn\ floating or high, not low? MAX Din to Stamp output serDo, MAX Dout to Stamp input serDin (a common source of mixup!)? Do you have an oscilloscope to check for activity on the pins?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • CMCM Posts: 7
    edited 2007-12-19 21:11
    Tracy,
    I rechecked the wiring and I found an error on the PCB. It is now corrected and and it is functioning. Thanks for your effort.
    BR/CM
Sign In or Register to comment.