U

12 Bit ADC okuma

Başlatan umitco, 06 Mayıs 2012, 11:22:04

umitco

  Arkadaşlar  12 Bit veya üstü ADC entegreyle veya 12 Bit ADC si olan bir işlemciyle okuma yapan oldumu hiç ?  MCP3201 adında bir entegre aldım ama çalıştıramadım. Eğer sizin denediğiniz ve çalıştırdığınız bir entegre varsa denemek isterim...

Hattuşa

slm
elimde mcp3201 ver ve ben bunu nasıl çalıştıracağımı öğrenemedim, bununla ilgili yardımcı olabilirmisiniz?
Device 18F4520Xtal 10Config_Start   OSC = HSPLL ; HS oscillator, PLL enabled (Clock Frequency=4 x FOSC1)   PWRT = On ; PWRT enabled   BOREN = OFF ; Brown-out Reset disabled in hardware and software   WDT = OFF ; WDT disabled (control is placed on the SWDTEN bit)   MCLRE = On ; MCLR pin enabled; RE3 input pin disabled   Debug = OFF ; Background debugger disabled, RB6 and RB7 configured as general purpose I/O pinsConfig_EndDeclare PLL_Req TRUE '40mhzDeclare LCD_DTPort =PORTDDeclare LCD_RSPin =PORTB.2Declare LCD_ENPin =PORTB.0Declare LCD_RWPin =PORTB.1Declare LCD_CS1Pin =PORTB.4Declare LCD_CS2Pin =PORTB.3Declare LCD_Type =GRAPHIC Internal_Font = On Font_Addr = 0Declare GLCD_CS_Invert =0 Declare GLCD_STROBE_DELAY = 100Declare PortB_Pullups =OffAll_Digital yesDim adres1 As WordDim var1 As ByteSymbol cs PORTA.0Symbol di PORTA.1Symbol ck PORTA.2TRISA=%00000010TRISB= %00000000TRISC=%000000000TRISD=%00000000TRISE=%00000000PORTA=0PORTB=0PORTC=0PORTE=0PORTD=0DelayMS 1ClsDelayMS 100Set cs'deselect chipClear ck'low clockloop:Call convertPrint At 1,1,Dec adres1," "DelayMS 100GoTo loop'--------------------convert:Clear cs'start conversionDelayUS 1'2 clock for conversion & 1 clock for null bitFor var1 = 0 To 2 step1Set ckDelayUS 80Clear ckDelayUS 80NextCall capture ' this capture msb bit-11For var1 = 0 To 10Set ckDelayUS 80Clear ckDelayUS 80Call captureNextSet cs 'deselect chip'now adres contains your 12 bit dataReturncapture:If di = 1 ThenClear STATUS.0adres1 = adres1 << 1Set adres1.0ReturnElseClear STATUS.0adres1 = adres1 << 1EndIfReturnEndInclude "FONT.INC"


adres isimli değişkeni direk adres diyerek yazınca hata veriyor. adres1 yapıyorum sonuç 0 çıkıyor, sanırım mantığını çözemedim
yardımcı olabilirmisiniz

a.zorba


Hattuşa


Powered by EzPortal