Malformed PIC tag, added above. On Mon, Mar 4, 2013 at 2:40 PM, Mr Smiley wrote: > Hi everybody, > > I wonder if anybody could help with a problem I have with converting a de= cimal digit into a bitmap. > > The Project. > > I'm building a piece of electronic test equipment and need to display 4 l= ines of digital information on a display. Problem is It's only a small encl= osure and so I=92ve started playing with a Nokia 5110 phone lcd display. > > I have the display initialized and don't have any problems there. > > The digit I want to display is placed into w, from there I call a lookup = table that consists of a number of goto's to the relevant routine that call= s another lookup table that gets the bitmap info that is sent to the lcd di= splay. > > My table to show a 0 on the display > > Asci_0 addwf PCL,f > dt 0x00, 0x00, 0x3e, 0x51, 0x49, 0x45, 0x3e = ;30 0 > > Following this are tables for bitmap info for digits 1 to 9 > > The start of the table is located at address 0x17. > > The sub routine that displays that digit on the lcd display > > LCD_DIG0 > ;now set up loop counter to send 5 bytes per digit > > ;set display to recieve data > > bsf LCD_DC ;enable next as data > bcf LCD_CE ;enable serial link > > movlw 0x06 ;number of bytes = per digit > movwf loop2 ;put into loop counter > > ;now send 5 bytes from Asci_0 > > LCD_DIG0_L1 > > movf loop2,w ;put count into w > call Asci_0 ;go get first byte > movwf Sdata ;put into Sdata ready to send > call LCD_SND ;put out to lcd > > decfsz loop2,f ;have we sent 5 bytes > goto LCD_DIG0_L1 > bsf LCD_CE ;disable serial link > > return > > The goto table is > > DIG_BMP > > addwf PCL,f > goto LCD_DIG0 > goto LCD_DIG1 > goto LCD_DIG2 > goto LCD_DIG3 > goto LCD_DIG4 > goto LCD_DIG5 > goto LCD_DIG6 > goto LCD_DIG7 > goto LCD_DIG8 > goto LCD_DIG9 > > > > The main code block is; > > main > ;pre-set all data lines > > bsf LCD_CE > bcf LCD_SCK > bcf LCD_SDA > bcf LCD_DC > > ;set up display > > call LCD_Setup > > > L1 call LCD_ADD ;reset digit location > movlw 0x00 > call DIG_BMP > call Very_Dlong ;long delay between digit updates > > call LCD_ADD > movlw 0x01 > call DIG_BMP > call Very_Dlong > > call LCD_ADD > movlw 0x02 > call DIG_BMP > call Very_Dlong > > call LCD_ADD > movlw 0x03 > call DIG_BMP > call Very_Dlong > call LCD_ADD > movlw 0x04 > call DIG_BMP > call Very_Dlong > > call LCD_ADD > movlw 0x05 > call DIG_BMP > call Very_Dlong > > call LCD_ADD > movlw 0x06 > call DIG_BMP > call Very_Dlong > > call LCD_ADD > movlw 0x07 > call DIG_BMP > call Very_Dlong > > call LCD_ADD > movlw 0x08 > call DIG_BMP > call Very_Dlong > > call LCD_ADD > movlw 0x09 > call DIG_BMP > call Very_Dlong > > goto L1 > > goto main ;just in case > > > The above is to display 0 to 9 on the display and loop round. > > Using MPLABX(1.60), the simulator runs as expected, the stack never under= or over flows, all ports and registers are as expected, no warnings displa= yed when compiled. > > Running on the pic ( 12F683 ) nothing is displayed, it's blank, but the = display indicates that it has been initialised by the grid showing up as a = contrast layer. > > Now, if I do the following; > > L1 call LCD_ADD ;reset digit location > call LCD_DIG0 > call Very_Dlong > > call LCD_ADD > call LCD_DIG1 > call Very_Dlong > > call LCD_ADD > call LCD_DIG2 > call Very_Dlong > > call LCD_ADD > call LCD_DIG3 > > call Very_Dlong > > call LCD_ADD > call LCD_DIG4 > call Very_Dlong > > call LCD_ADD > call LCD_DIG5 > call Very_Dlong > > call LCD_ADD > call LCD_DIG6 > call Very_Dlong > > call LCD_ADD > call LCD_DIG7 > call Very_Dlong > > call LCD_ADD > call LCD_DIG8 > call Very_Dlong > > call LCD_ADD > call LCD_DIG9 > call Very_Dlong > > goto L1 > > goto main > > Again, the simulator says all is as expected, on the pic IT WORKS. > > This shows that all my LCD_DIGxx's are working and the bitmap tables are = correct. > > I'm thinking it's something to do with the combination of calls and goto'= s but I can't see where it is. The stack always returns to 0 when returning= to main. > > In summary, when it does not work i'm doing the following > > put digit into w > call a goto table (DIG_BMP) stack +1 > goto a routing (LCD_DIG0) > call a couple of other routines - send to display > At the very end return to main stack -1 > > Stack back to 0 when it returns to the main routine. > > Can anybody see from the above info, or my use of the goto from a call, w= hat it could be. > > If you need any further info please request. > > At the moment I=92m at a standstill, next is bigger digits > > Many thanks for reading :o) > > -- > http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .