Jump to content

Search the Community

Showing results for tags 'dual adc bleed over'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • PIC Embedded Programming
    • BoostC and Chameleon compilers programming
    • BoostC porting source code
    • BoostC++ compiler programming
    • BoostBasic compiler programming
    • Assembler programming PIC
    • Novo RTOS Programming
    • Hardware PIC
    • Enhancement Requests
    • Bug Reports

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 1 result

  1. I am using the easypic5 development board from Mikroe and a 16f876 chip, all switches are tripple checked for on off and I'm 90% sure this is configured right I have been fighting this for a week! kind of an obsession now! The display is a HD4478 based 4 line running in 4 bit mode, board powered from both usb and had powered externally to see if I was having a power issue. I thought at one point the optimization was doing something so I turned that off... so the issue.. I have 2 pots on the board that put 0-5v on the an0 and an1 pins I can get these 2 routines to run individually and they give me full scale readings 0-5v but when I run them together, even with MAJOR waits (these are smaller now) they read wrong, like there is still discharge time on the adc caps? bleed over? DO i need to clear the adresh and adresl registers??? the simulator works OK, I have full license and plugins. if I turn up an0 it goes to maybe 20f (527 dec) and then when I turn up ad1 they both go full, then when I turn down an0 the an1 goes to about halve again they interfere with each other. I did read on here about waiting inbetween measurings...but I put delay_ms(500) and other than a hard to read display its still not correct. can someone let me know what I am doing incorrectly? I have even changed processors and its the same way (I used the 16f877a they supplied with the board previously) thanks! Chuck #include <system.h> #include <adc.h> #include <stdlib.h> #include <pic16f876.h> #include <lcd_driver.h> #define LCD_ARGS 1, /* Interface type: mode 0 = 8bit, 1 = 4bit(low nibble), 2 = 4bit(upper nibble) */ \ 0, /* Use busy signal: 1 = use busy, 0 = use time delays */\ PORTB, TRISB, /* Data port and data port tris register */ \ PORTB, TRISB, /* Control port and control port tris register */ \ 4, /* Bit number of control port is connected to RS */ \ 6, /* Bit number of control port is connected to RW */ \ 5 /* Bit number of control port is connected to Enable */ //Target PIC16F876 configuration word #pragma DATA _CONFIG, _PWRTE_OFF & _BODEN_ON & _WDT_OFF & _LVP_OFF & _CPD_OFF & _DEBUG_OFF & _HS_OSC & _CP_OFF //Set clock frequency #pragma CLOCK_FREQ 4000000 //8mhz xtal #pragma OPTIMIZE "0" //no optimization void voltmeter(void); void voltmeter2(void); void main( void ) { trisa=0xff; lcd_setup(); lcd_clear(); while(1){ delay_ms(10); voltmeter(); delay_ms(10); voltmeter2(); } } //------------------------------------------------------------------------------------------------------ void voltmeter() { volatile bit Go_Done@ADCON0.2; volatile unsigned char ad_h@ADRESH; volatile unsigned char ad_l@ADRESL; unsigned int AD_Result; unsigned int shiftH; unsigned int shiftL; adcon0=0x41; //fosc8 chan0 ad on adcon1 = 0x04; // left justified fosc8 an0-1-3 selected Go_Done=1; while ( Go_Done == 1 ){ delay_ms(5); } lcd_gotoxy( 0, 0 ); shiftH = ad_h; shiftL = ad_l; AD_Result = (shiftH<<2) | (shiftL>>6); lprintf("A/D0 :%03X ", AD_Result ); delay_ms(10); lcd_clear(); adcon0=0x00; //turn off adc delay_ms(10); } //-------------------------------------voltmeter2-------------------------------------------------------- void voltmeter2() { volatile bit Go_DoneA@ADCON0.2; volatile unsigned char ad_hA@ADRESH; volatile unsigned char ad_lA@ADRESL; unsigned int AD_ResultA; unsigned int shiftHA; unsigned int shiftLA; adcon0 = 0x49; //fosc8 chan1 ad on adcon1 = 0x04; // left justified fosc8 an0-1-3 selected Go_DoneA=1; while ( Go_DoneA == 1 ){ delay_ms(5); } lcd_gotoxy( 0, 1 ); shiftHA = ad_hA; shiftLA = ad_lA; AD_ResultA = (shiftHA<<2) | (shiftLA>>6); lprintf("A/D1 :%03X ", AD_ResultA ); delay_ms(10); lcd_clear(); adcon0=0x00; //turn off adc delay_ms(2);
  • Create New...