This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C18C44.7159F470 Content-Type: text/plain I thought I did mail it. Anyway here it is and as I said the code is dirty ... Justin -----Original Message----- From: PRINCE JESWIN [mailto:princejeswin@YAHOO.COM] Sent: Thursday, 20 December 2001 16:26 To: PICLIST@MITVMA.MIT.EDU Subject: Re: graphical displays Hi, It would be definitely a great help if you can mail me the code. You can send it to me in the list, since somebody else would also be able to use it. Regards Jeswin --- "Richards, Justin P" wrote: > I have some code (16F84) which I use to display a > revolution count in > hexadecimal on a graphical display. The display has > 3 pages (screens), and > each page is 64 x 64 dots. It has a ks0107b and 3 > ks0108b controllers. > > A number found on the disp is WD-G1906B but doesn't > mean anything to me. > > The only way I could think to make it work was > generate the characters each > time I displayed them. Each character code is > stored in a byte, where each > bit determines when to draw a line segment and each > bit position corresponds > to a different line segment. It does make it easy > to change the size of the > characters as you simply change the number of times > you display the line > seg. > > There must be better ways, but they would require > more memory to store > codes. I still prog like I did for the 68HC11 where > memory was at a > premium. 256 bytes I think > ........ > .. .. > .. .. > .. .. > ........ > .. .. > .. .. > .. .. > > I will email the code off list (is this the way to > do it or do I send it to > the list? anyone). The code is still dirty (but > works well) and may not be > very easy to follow i.e. not well documented as I > dropped it in favour of > character disp. > > Also have code that displays 8 different ADC on same > display for 68HC11 if > this is any good to you. > > Justin > > -----Original Message----- > From: PRINCE JESWIN [mailto:princejeswin@YAHOO.COM] > Sent: Thursday, 13 December 2001 21:04 > To: PICLIST@MITVMA.MIT.EDU > Subject: graphical displays > > > Hi Everybody, > I am a new bie to this list. > > I am using a graphical Lcd display SG12864c which is > using a controller ks0107. > I do not know how to handle the graphical lcd but i > do > know how to handle a character lcd. > If any one is having a assembly routine kindly put > it > across. > can any one help me out. > > Prince+ > > __________________________________________________ > Do You Yahoo!? > Check out Yahoo! Shopping and Yahoo! Auctions for > all of > your unique holiday gifts! Buy at > http://shopping.yahoo.com > or bid at http://auctions.yahoo.com > > -- > http://www.piclist.com hint: PICList Posts must > start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other > [BUY]:,[AD]: ->Ads > > -- > http://www.piclist.com#nomail Going offline? Don't > AutoReply us! > email listserv@mitvma.mit.edu with SET PICList > DIGEST in the body > > __________________________________________________ Do You Yahoo!? Check out Yahoo! Shopping and Yahoo! Auctions for all of your unique holiday gifts! Buy at http://shopping.yahoo.com or bid at http://auctions.yahoo.com -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. ------_=_NextPart_000_01C18C44.7159F470 Content-Type: application/octet-stream; name="rc.pic" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="rc.pic" config 3ff2h ;; WDT Enabled, RC Oscillator ;Author Justin Richards ;Start Date 07/04/2001 ;End Date=09 ;Prog RC.PIC for 16F84 pic processor ;Desc This program is designed to encode shaft rotation and=20 ; drive a WD-g1906B graphical LCD with the RPM value ;=09 ; This requires the use of only three outputs. One to send the data ; (DispData), one to clock the data in (DispClock), and one to ; drive the data out of the shift regs once they have been updated =20 include 16f84reg.inc ;Define Outputs = ************************************************************* DispSel0 equ Rb1 DispSel1 equ Rb2 DispData equ Rb3 DispClock equ Rb4 DispStrobe equ Rb5 RegSel equ Rb6 Spare equ Rb7 ;Define Ram = *************************************************************** orgdata RamBase Num1 RB 1 Num2 RB 1 Num3 RB 1 NibbleNum1 RB 1 NibbleNum2 RB 1 NibbleNum3 RB 1 NibbleNum4 RB 1 NibbleNum5 RB 1 NibbleNum6 RB 1 Disp RB 1 ;Stores pattern of segment to be 'outed' FSRSave RB 1 ;First FSR save variable FSRSave2 RB 1 ;Seconds FSR save variable Temp RB 1 ;Used as block addr in EEPROM to copy to RAM Temp2 Rb 1 Key RB 1 ;Variables used by ReadKey NewKey RB 1 ;used by ReadKey OldKey RB 1 ;used by Readkey WSave RB 1 ;Stores W register for interupt StatusSave RB 1 ;Stores STATUS reg for int routine Counter RB 1 ;Counter used by TMR0 Interrupt. Seconds RB 1 ;Variable used by DelaySecs Flag RB 1 ;Program flag variables Page RB 1 Col RB 1 DispLine RB 1 Scr RB 1 Data RB 1 Char RB 1 Bool1 equ flag.0 ;Flags display has chaged and needs a refresh Bool2 equ flag.1 ;TMR0 INT flags DelaySecs that Seconds is over TimeOut equ flag.2 Scr0 equ Scr.0 Scr1 equ Scr.1 ;EOF DefRam=20 ;Define EEPROM = ************************************************************ orgeedata 0 ;EEBase Zero DBEE 0dbh One DBEE 88h Two DBEE 5eh Three DBEE 0ceh Four DBEE 8dh Five DBEE 0c7h Six DBEE 0d7h Seven DBEE 8ah Eight DBEE 0dfh Nine DBEE 0cfh Ah DBEE 9fh Bh DBEE 0f1h Ch DBEE 53h Dh DBEE 0f8h Eh DBEE 57h Fh DBEE 17h ;Define Inputs (Keyboard) = ************************************************** UpKey equ Key.0h ;Ra0 ;Increments active display DownKey equ Key.1h ;Ra1 ;Decrements active display SelKey equ Key.2h ;Ra2 ;Changes the active display StartKey equ Key.3h ;Ra3 ;Start process ;Define Constants = ********************************************************** DispOn equ 3fh DispOff equ 3eh FirstPage equ 0b8h ;0-7 LastPage equ 0bfh LastPage+1 equ 0c0h FirstCol equ 40h ;0-63 LastCol equ 7fh FirstDispLine equ 0c0h ;0-63 LastDispLine equ 0ffh ;Program Start = ************************************************************ org ProgramStart ;Originate Program at address 0 goto main ;Jump over Int Routine org InterruptStart ;Originate Int routine at Address 4 movwf WSave ;Saving Regs movf status,w ;Saving Regs bcf rp0 ;Saving Regs movwf StatusSave ;Saving Regs =09 btfsc T0IF ;Is Timer0 Int flag set goto Timer0 btfsc INTF goto IntRb0 goto exit IntRb0 bcf INTF incf Num3,f btfsc z incf Num2,f btfsc z incf Num1,f goto Exit Timer0 bcf T0IF ;clear the flag incf Counter,f ;Increment Counter movlw 25 ;get ready to test if it is 25 xorwf Counter,w ;Does counter =3D 25 btfss Z ;if no exit interrupt goto Exit =09 clrf Counter ;clear counter bsf TimeOut ;Flag to Delaysecs that delay is over Exit movf StatusSave,w ;Restoring Regs movwf Status ;Restoring Regs swapf WSave,f ;Restoring Regs swapf WSave,w ;Restoring Regs retfie ;Main = ******************************************************************** ;Main Routine acts on keys as they are pressed. Increments and = Decrements ;segs, calculates delay times when the start key is pressed.=20 ;Calls Delay routines and turn Relays on and off main call Initialize ;set ports clear variables and en ints call InitLCD clrw movwf Num1,f movwf Num2,f movwf Num3,f movlw FirstPage movwf Page movlw FirstCol movwf Col clrf Scr,f Call SetPageColScr KeyWait ;call ReadKey ;get key state; Call DispNum clrw movwf Num1,f movwf Num2,f movwf Num3,f bsf INTE ;Enable Interrupts call DelaySecs ;Delay 1 sec bcf INTE ;Disable Interrupts movlw FirstPage ; movwf Page Call SetPageColScr ; btfss UpKey ;Skip if UP Key pressed goto Keywait ;wait for next key ;End of program =09 ;Display 5 digit number = **************************************************** ;It destroys contents of number DispNum movf Num1,w andlw 0fh movwf NibbleNum2 swapf Num1,w andlw 0fh movwf NibbleNum1 movf Num2,w andlw 0fh movwf NibbleNum4 swapf Num2,w andlw 0fh movwf NibbleNum3 movf Num3,w andlw 0fh movwf NibbleNum6 swapf Num3,w andlw 0fh movwf NibbleNum5 bcf Bool1 NextLine movlw NibbleNum1 movwf FSR,f DispNextChar movf INDF,w btfss Bool1 Call W2Seg Call DispChar incf FSR,f movlw Disp xorwf FSR,w btfss Z goto DispNextChar incf Page,f call SetPageColScr btfsc Bool1 return bsf Bool1 goto NextLine ;End Display 5 Digit number ;Display Character in W = *************************************************** DispChar movwf Char,f=09 clrw=09 rrf char,f ;rotate disp code left btfsc C ;was a 1 rotated out movlw 0ffh call OutByte call OutByte clrw rrf char,f btfsc C movlw 3h rrf char,f btfsc C addlw 0c0h,w call OutByte call OutByte call OutByte call OutByte call OutByte clrw rrf char,f btfsc C movlw 0ffh,w call OutByte call OutByte clrw=09 call Outbyte movf char,w movwf INDF,f Return ;End Display Character in W ;Read PortA Keys Sub = ****************************************************** ReadKey movf NewKey,w ;Dont know what this does exactly movwf OldKey ;got it out of the book and it movf PortA,w ;seems to work. I would just read=20 andlw 1fh ;port A and leave it at that movwf NewKey ;But dont mess with what works hey comf NewKey,f andwf OldKey,w movwf Key return ;End Read PortA Keys Sub ;Initialize Sub = *********************************************************** Initialize clrwdt ;Turn Watchdog timer of as used by TMR0 bsf rp0 ;Switch to Bank1 tris Reg live here movlw 86h ;Pull ups Disabled & Prescaler 256 movwf option ;Option reg configures the PIC movlw 1fh ;PortA all as Input movwf trisa ;TrisA reg configures PortA movlw 1 ;PortB all as Output movwf trisb ;Trisb reg configures PortB ; movlw 0 ;Disables Global INT and TMR0 =20 ; movwf intcon ;intcon reg configures Interrupts bcf rp0 ;Switch to Bank0 ; clrf portb ;Clear it for hell of it ; clrf porta ;again clrf Counter ;Clears TMR0 Int counter clrf flag ;clr all prog flags.2 bits are used ; movlw 2 ;Adj TMR0 val for latency of write ; movwf tmr0 ;this resets Prescaler and TMR0 cnts ; movlw 0a0h ;Enables Global INT and TMR0 =20 ; movwf intcon ;Configs Interrupt Control Reg ; movlw 90h ; movwf intcon bsf GIE ; bsf INTE Return ;Return to Main ;End Initialize Sub ;InitLCD Sub = ************************************************************** InitLCD =09 clrf Scr=09 NextScreen movlw FirstPage ;Page 0 of 8 movwf Page,f movlw FirstCol ;Col 0 - 63 movwf Col,f movlw FirstDispLine ;Line 0 - 63 movwf DispLine NextPage call SetPageColScr =09 movlw 64 movwf temp2,f NextByte movlw 81h ;clearing byte call OutByte=09 decfsz temp2,f ;decrement counter and test if zero goto NextByte ;not yet zero so do next Byte incf Page,f movlw LastPage+1 xorwf Page,w btfss Z goto NextPage incf Scr,f movlw 3 xorwf Scr,w btfss Z goto NextScreen Return ;End InitLCD ;Set Page Col and Screen = *************************************************** SetPageColScr bcf DispSel0 bcf DispSel1 btfsc Scr0 bsf DispSel0 btfsc Scr1 bsf DispSel1 bcf RegSel movf Page,w call OutByte movf Col,w call OutByte movf DispLine,w call OutByte movlw DispOn ;Turn Screen On Call OutByte bsf RegSel return ;End SetPageColScr ;Scroll ; bcf RegSel ;Controller Instruct Mode ; movlw 0c0h ; movwf Temp2,f ;nextline ; call delaysecs ; movf Temp2,w ; movwf Disp,f ; call OutByte ; incf Temp2,f ; movlw 0ffh ; xorwf Temp2,w ; btfss Z ; goto nextline ; movf Temp2,w ; movwf Disp,f =09 ; return=09 ;DelaySecs Sub = ************************************************************ ; Delays for number of seconds in "Seconds" Variable and ; Shifts the Decimal Point at 1 sec intervals. ; Sub uses TMR0 interrupt on timeout DelaySecs=09 movlw 1 movwf Seconds movlw 2 ;Adj TMR0 val for latency of write movwf tmr0 ;this resets Prescaler and TMR0 cnts bsf T0IE ; movlw 0a0h ;Enables Global INT and TMR0 =20 ; movwf intcon ;Configs Interrupt Control Reg bcf TimeOut ;Timeout set by INT after 1 sec NotTimedOut btfss TimeOut ;has the interrupt set the flag goto NotTimedOut ;no, continue to wait bcf TimeOut ;clear for next second=20 decfsz Seconds,f ;Dec Seconds and skip if zero goto NotTimedOut ;Delay has not finished so continue ; movlw 00h ;Disables Global INT and TMR0 =20 ; movwf intcon ;Dont need INT=20 bcf T0IE return ;DelaySecs End Sub=20 =09 ;OutByte Sub ********************************************************** OutByte NotActive movwf Data,f movlw 8 ;get ready to out 8 bits movwf Temp ;Temp is counter movf Data,w NextBit rlf Data,f ;rotate disp code left btfsc C ;was a 1 rotated out goto SendHi ;Yes set pin HI bcf DispData ;No, then Set pin to LOW=09 goto Send ;clock out a '0' SendHi bsf DispData ;Set pin to HI Send bsf DispClock ;clocks data into 4094 bcf DispClock ;clock pin low decfsz temp,f goto NextBit bsf DispStrobe ;Out the internal regs to the pins bcf DispStrobe ;return pin to normal state bcf DispData ;return pin to normal Return ;Exit Sub ;OutByte End Sub ;Convert W to Seven (Eight) seg code = ************************************** W2Seg movwf EEADR,f bsf rp0 ;change to bank 1 bsf RD ;Initiates a EEPROM read bcf rp0 ;back to bank 0 movf EEData,w ;move contents to W Return ;End W2Seg=20 ;EepromToRam Sub = ********************************************************** ;EepromToRam=09 ; movf Temp,w ;PTR to EEPROM block ; movwf EEADR,f ;EEPROM Addr register =09 ; movlw FaceTens ;Get address of Disp memory ; movwf FSR,f ;mov it to the indirect reg ;ShiftNextEEByte bsf rp0 ;change to bank 1 ; bsf RD ;Initiates a EEPROM read ; bcf rp0 ;back to bank 0 ; movf EEData,w ;move contents to W ; movwf INDF,f ;mov w to address FSR ; incf FSR,f ;Point to next Ram Byte ; incf EEADR,f ;Point to next EEPROM byte ; movlw Wsave,w ;Addr last byte + 1 ; xorwf FSR,w ;test if they are equal ; btfss Z ;Yes, skip and finish mov routine ; goto ShiftNextEEByte ;No, shift the next byte ; return ;EepromToRam End Sub ;RamToEeprom Sub = ********************************************************** ; move 5 bytes of ram pointed to by FaceTens and copies them ; to EEPROM pointed to by EEFaceTens =20 ;RamToEeprom movf FSR,w ;Get ready to save FSR ; movlw 0 ;Get address of Ram 5 byte block ; movwf FSR,f ;mov it to indirect addr PTR ; movlw EEFaceTens ;Address where test data written ; movwf EEADR,f ;move it to the address reg ShiftNextRamByte ; movf INDF,w ;just some test data ; movwf EEData,f ;move it the Data reg=09 ; =09 ; bcf GIE ;Disable all interrupts ; btfsc GIE ;was it successful ; goto ShiftNextRamByte;no, try and set it again ; bsf RP0 ;switch to bank 1 ; bsf WREN ;Enable EEprom writes ; bcf EEIF ;clear the write success flag=09 ; ; movlw 55h,w ;55 because the manual says so ; movwf EECON2,f ;write it to the control reg ; movlw 0AAh,w ;AA because the manual says so ; movwf EECON2,f ;write it to the control reg ; ; bsf WR ;this initiates the write ; bsf GIE ;re-enable interrupts ; nop ;just in case it needs some time ;WaitForWrite btfsc WR ;has the write finished ; goto WaitForWrite ;no, then wait some more ; bcf EEIF ;clear the flag=20 ; bcf WREN ;clear WREN when not writing ; bcf RP0 ;switch back to bank 0 ; incf FSR,f ;Point to next ram location ; incf EEADR,f ;Point to next EEProm location ; movlw Wsave,w ;addr of last Ram byte + 1 ; xorwf FSR,w ;Test if they are the same ; btfss Z ;Skip if equal and exit ; goto ShiftNextRamByte;shift next byte ; ; movf FSRSave,w ;Get ready to restore FSR ; movwf FSR,f ;Restore FSR ; return ;Exit subroutine ;RamToEeprom End Sub ; movlw Num ; movwf FSR,f ; movlw 3 ; movwf Temp ;LoadNextChar ; movf Temp,w ; movwf INDF,f ; incf FSR,f ; decf Temp,f ; btfss Z ; goto LoadNextChar =09 incf Num3,f btfsc z incf Num2,f btfsc z incf Num1,f movf Num1,w andlw 0fh movwf NibbleNum2 swapf Num1,w andlw 0fh movwf NibbleNum1 movf Num2,w andlw 0fh movwf NibbleNum4 swapf Num2,w andlw 0fh movwf NibbleNum3 movf Num3,w andlw 0fh movwf NibbleNum6 swapf Num3,w andlw 0fh movwf NibbleNum5 ------_=_NextPart_000_01C18C44.7159F470-- -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics