Hi Colin, Ya maken me feel guilty mate. Thanks for the code regarding the lCD Bit of tweaking and its now up and running. Again thank you, Kind Regards Grant Brown cdb wrote: > :: I'm building a 3 digit LCD display trying to use a Microchip's > :: AY0438 > :::: controller. > > Even though you have yet to acknowledge the code I sent twice directly to you, here is some outline code that directly 'talks' to glass LCD's without the need for a controller. I haven't looked up the uChip part, but doesn't its' datasheet have any code examples in it? > > The com pin goes to the centre of two resistors in series. The ends of the resistors connecting one each to Vcc and Ground. IOW a voltage divider. > > I couldn't be bothered with comments in this version! > > C code for 2 common glass LCD 3.5 digits > > /************************************************************************ > ** Program for 3.5, 4.5 digit controllerless LCD's ** > ** ** > ** v0.1b ** > **copyright C.D. Barnard 7 February 2004 ** > ** ** > ************************************************************************/ > > /* PortB = LSD > ** PortC = Dig > ** PortD = MSD > ** PortE = DP,LoBat, + > ** PortA = COM > ** > ** Each set of segments are on the bottom 6 bits of the port, this leaves > ** portC bit 7 (Rx) free. > ** > **/ > #define COM bRA0 > #include > //#include > #include > void display(); > void format(unsigned int n); > void setup(); > /*uint*/ > // WORD power_10(WORD digit); > void Interrupt(); > BYTE phase=0; > struct flags > { > bit dummy; > bit dummy; > bit dummy; > bit dummy; > bit dummy; > bit dummy; > bit dummy; > bit tmr0F; > } flag; > > BYTE x,temp; > WORD z,no; > const char segments[12]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x67,0x6E,0x79}; This depends on glass column layout. > // 0 1 2 3 4 5 6 7 8 9 Y E > BYTE digits[4]; > > void main() // Function to > { > //unsigned int no; > setup(); > > digits[3]=0; > no=0; > > format(no); > while(1) > { display(); > Wait(100); > format(no); > } > > /* digits[2]=segments[10]; > digits[1]=segments[11]; > digits[0]=segments[5]; > */ > > } > > > > void setup() > { > TMR0=0; > ADCON1=0x07; > PORTA=0x01; > PORTB=0; > PORTC=0; > PORTD=0; > PORTE=0; > TRISB=0; > TRISA=0; > TRISC=0; > TRISD=0; > TRISE=0; > OPTION_REG=(1< INTCON=(1< } > > void Interrupt() > { > if (bT0IF) > { > bT0IF=0; > phase++; > flag.tmr0F=1; > } > } > > > void display() > { > if (flag.tmr0F) > { > if (phase &1) > { > PORTE=digits[3]; > PORTD=digits[2]; > PORTC=digits[1]; > PORTB=digits[0]; > COM=0; > no++; > } > else > { > PORTE=~digits[3] ; > PORTD=~digits[2]; > PORTC=~digits[1]; > PORTB=~digits[0]; > COM=1; > } > flag.tmr0F=0; > > } > } > > > > void format(WORD n) > { > WORD x; > > x=0; > while (n >= 1000) > { > x++; > n-=1000; > > } > digits[3]=segments[x]; > x=0; > > while(n >=100) > { x++; > n -= 100; > > } > digits[2]=segments[x]; > x=0; > while (n >= 10) > { > > n-=10; > x++; > > } > digits[1]=segments[x]; > digits[0]=segments[n]; > > > } > -- > cdb, colin@btech-online.co.uk on 6/11/2008 > > Web presence: www.btech-online.co.uk > > Hosted by: www.1and1.co.uk/?k_id=7988359 > > > > > > > -- Kind Regards Grant Brown SiteDoc Pty Ltd mob: 0412 926 995 www.sitedoc.com.au __________________________________________________________________________________________________________ This email message together with any attachments is intended only for the addressee(s) and contains information that may be confidential and/or copyright. If you are not the intended recipient, please notify the sender by reply email (or telephone SiteDoc Pty Ltd on +61 2 42291185) and immediately delete this email together with any attachments from your computer. If you are the intended recipient, you must not copy, disclose, reproduce or distribute this communication together with any attachments without the authority of SiteDoc Proprietary Limited. No representation is made that this email or any attachments are free of viruses. Virus scanning is recommended and is the responsibility of the recipient. Unless specifically stated by the sender as the views of SiteDoc Proprietary Limited, any views expressed in this message are those of the individual sender, and no responsibility will be borne by SiteDoc Proprietary Limited for its content or outcomes. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist