Quantcast
Viewing all articles
Browse latest Browse all 20573

Share your working BASCOM-AVR code here : OLED Display using SSD1306 with i2c. Char Mode 16x4 : REPLY

Hello Again. After what you told me during this time I've been modifying and changing the Ini (set) addresess. I can already see text and some small image. But I can do now is to put the text in the coordinates X and Y, I changed Addresses but Nothing works.!! For example: I want to put "Hello" Up and "World" Below with X and Y positions, is impossible!!. It always starts up, "Hello" and after "World". and sometimes the text runs the Left and not still. -------------------------------- 0| Hello | 1| World | 2| | 3| | y 4| | |__X 5| | 6| | 7| | 0 -------------------------------- 127 My small successes: [img:9fc8c1726a]http://imageshack.us/a/img825/9524/u1nr.jpg[/img:9fc8c1726a] _________________________________________________ '''' CODE: __________________________________________________ Dim Lcd_Data as Byte Dim A as Byte Const Oled_address = &H78 Declare Sub Text Declare Sub XXYY (byval X As Byte , Byval Y As Byte) i2cstart i2cwbyte OLED_Address i2cwbyte &HAE 'Display off i2cwbyte &H00 'Set lower column start address for page addressing mode at 0 i2cwbyte &H10 'Set higher column start address for page addressing mode at 0 * i2cwbyte &H20 'Vertical addressing mode i2cwbyte &H01 i2cwbyte &H21 'Set Ini and End Column i2cwbyte &H00 i2cwbyte &H7F 'Set x127 i2cwbyte &H22 'Set Start and end page i2cwbyte &H00 i2cwbyte &H40 'Set x64 i2cwbyte &HB0 'Set page start address i2cwbyte &H40 'Set display start line at 0 i2cwbyte &H81 'Set contrast i2cwbyte &H7F 'at AFh = 175d i2cwbyte &HA1 'Column address is mapped to SEG0 i2cwbyte &HA6 'A6= Normal display, A7 = inversed i2cwbyte &HA8 'Set multiplex ratio i2cwbyte &H1F '0F 'at 0F = 15 i2cwbyte &HD3 'Set display offset i2cwbyte &H00 '7 'at 00 = 0 Probably Y !!! i2cwbyte &HD5 'Set display clock divide ratio/oscillator frequency i2cwbyte &H80 'F0 'at 80 = 128 i2cwbyte &HD9 'set precharge period i2cwbyte &HF1 ' 22 - External, F1 - Internal i2cwbyte &HDA 'Set COM pins hardware configuration i2cwbyte &H02 'at 02 = 2 i2cwbyte &HDB 'Set Vcomm deselect level at 0.77 x Vcc i2cwbyte &H40 '20 = 32 40=64 i2cwbyte &HC8 'Reverse Data: C8=Reverse/C0= No Reverse i2cwbyte &HA4 'Display follows the RAM content i2cwbyte &H8D 'enable charge pump i2cwbyte &H14 'at 14h = 20d i2cwbyte &HAF 'Display on in normal mode i2cstop Waitms 100 Do Call Text Waitms 1000 Loop Sub Text: DelayMS 100 i2cstart i2cwbyte Oled_address i2cwbyte 0x40 'Write to display RAM Call XXYY (0,3) For A=0 To 127 'Put "Hellow" Lcd_Data = LookUp (A,DataHello) i2cwbyte Lcd_Data Next Call XXYY (9,9) For A=0 To 127 'Put "World" Lcd_Data = LookUp (A,DataWorld) i2cwbyte Lcd_Data Next i2cstop End Sub Sub XXYY: 'i2cstart 'i2cwbyte OLED_Address i2cwbyte &H21 i2cwbyte &H00 i2cwbyte X i2cwbyte &H7F '127 i2cwbyte &H22 i2cwbyte &H00 i2cwbyte Y i2cwbyte &H40 '64 'i2cstop End Sub __________________________________________________________ THX..

Viewing all articles
Browse latest Browse all 20573

Trending Articles