
سلام از دوستان کسی با بسکام این ماژول راه اندازی کرده
این چیپش هست از فروشگاه خریدم اما برای بسکام چیزی گیر نیاوردم که کار کنه البته کد زیر را خوندم و نوشتم اما کار نکرد
Driver IC: SSD1306
ارتباطش i2c هست
$regfile = "m32def.dat"
$crystal = 8000000
$hwstack = 32
$swstack = 40
$framesize = 40
$lib "i2c_twi.lbx"
Config Scl = Portc.0
Config Sda = Portc.1
Config Twi = 100000
Const Oled_address = &HA2
Const Write_cmd = &H01
Const Oled_reset = &H03
Const Oled_8x16str = &H10
Const Disp_area = &H11
Const Fill_area = &H12
Const Set_scrohor = &H13
Const Set_scrover = &H14
Const Set_scroverhor = &H15
Const Scroll_up = &H01
Const Scroll_down = &H00
Const Scroll_right = &H26
Const Scroll_left = &H27
Const Scroll_vr = &H29
Const Scroll_vl = &H2A
Const Scrollstop = &H2E
Dim A As Byte
Dim B As Byte
Dim C As String * 1
Declare Sub Resetdisplay
Declare Sub Deactivatescroll
Declare Sub Dispay8x16str(byval Page As Byte , Byval Column As Byte , Byval Char As String )
Declare Sub Scrollingvertical(byval Rowsfixed As Byte , Byval Rowsscroll As Byte , Byval Scrollsteb As Byte , Byval Stepdelay As Byte)
Declare Sub Scrollhorizontal(byval Lr As Byte , Byval Spage As Byte , Byval Epage As Byte , Byval Frames As Byte)
Declare Sub Fillarea(byval Spage As Byte , Byval Epage As Byte , Scloumn As Byte , Byval Ecolumn As Byte , Byval Filldate As Byte , )
I2cinit
Do
Call Resetdisplay
Waitms 100
Call Dispay8x16str(0 , 0 , "h"

Call Dispay8x16str(2 , 0 , "g"

Call Dispay8x16str(4 , 0 , "e"

Loop
End 'end program
Sub Fillarea(byval Spage As Byte , Byval Epage As Byte , Scloumn As Byte , Byval Ecolumn As Byte , Byval Filldate As Byte , )
I2cstart
I2cwbyte Oled_address
I2cwbyte Fill_area
I2cwbyte Spage
I2cwbyte Epage
I2cwbyte Scloumn
I2cwbyte Ecolumn
I2cwbyte Filldate
I2cstop
End Sub
Sub Deactivatescroll
I2cstart
I2cwbyte Oled_address
I2cwbyte Write_cmd
I2cwbyte Scrollstop
I2cstop
End Sub
Sub Scrollhorizontal(byval Lr As Byte , Byval Spage As Byte , Byval Epage As Byte , Byval Frames As Byte)
I2cstart
I2cwbyte Oled_address
I2cwbyte Set_scrohor
I2cwbyte Lr
I2cwbyte Spage
I2cwbyte Epage
I2cwbyte Frames
I2cstop
End Sub
Sub Scrollingvertical(byval Rowsfixed As Byte , Byval Rowsscroll As Byte , Byval Scrollsteb As Byte , Byval Stepdelay As Byte)
I2cstart
I2cwbyte Oled_address
I2cwbyte Set_scrover
I2cwbyte Scroll_up
I2cwbyte Rowsfixed
I2cwbyte Rowsscroll
I2cwbyte Scrollsteb
I2cwbyte Stepdelay
i2cstop
End Sub
Sub Dispay8x16str(byval Page As Byte , Byval Column As Byte , Byval Char As String )
I2cstart
I2cwbyte Oled_address
I2cwbyte Oled_8x16str
I2cwbyte Page
I2cwbyte Column
I2cwbyte Char
I2cstop
End Sub
Sub Resetdisplay
I2cstart
I2cwbyte Oled_address
I2cwbyte Oled_reset
I2cstop
End Sub
دیدگاه