At the moment the code doesn´t work. HELP!!
THX.
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' ''''''''''''''''''''''''''''''
' CODE
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''''''''''''''''''''''' '''''''''''''''''''''''''''''
Device = 18F4550 'Work PIC
Declare Xtal 20 'Set 20Mhz
All_Digital true 'Set All Digital Port
'Pins, I2C BUS ----------------------------------------------
Declare I2C_Slow_Bus On 'SLow el bus I2C
Declare SDA_Pin PORTB.0 'I2C (SDA)
Declare SCL_Pin PORTB.1 'I2C (SCL)
Declare Hbus_Bitrate 100 'I2C Bitrate 100Hz
'------------------------------------------------------------
' Program
'-------------------------------------------------------------
DelayMS 200 ' Wait for the PIC® micro to stabilise
'Initialitation of display Commands (data Sheet)
HBStart 'Send a Start condition to the I2C bus
HBusOut 0x3C 'Control, (Slave address)
HBusOut 0 'LowByte R/W#=0
HBusOut 0xAE 'Display off
HBusOut 0xD5 'Set Osc Frequency
HBusOut 0x80
HBusOut 0xA8 'Set Mux Ratio
HBusOut 0x3F
HBusOut 0xD3 'Set Display Offset
HBusOut 0x00
HBusOut 0x8D 'Set charge Pump regulator
HBusOut 0x14 'Or 0x10
HBusOut 0xA1 'Set Segment re-map or 0xA0
HBusOut 0xC8 'Set COM Output Scan Direction or 0xC0
HBusOut 0xDA 'Set COM pins Hardware Configuration
HBusOut 0x12 'or 0x02
HBusOut 0x81 'Set Contrast Control
HBusOut 0x81 'or 0x22, 0xCF
HBusOut 0xD9 'Set Pre-Charge Period
HBusOut 0xF1 'or 0xF22
HBusOut 0xDB 'Set VCOMH Deselect Level (Display Start Line)
HBusOut 0x40 'Display Start At 0
HBusOut 0xA5 'Set Disable Entire Display On or 0xA4h
HBusOut 0xA6 'Set Normal/ A7h Inverse Display
HBusOut 0xAF 'Set Display ON
HBStop 'Send a Stop condition to the I2C bus
Ini:
DelayMS 1000
'HBusOut 0x3C 'Control, (Slave address)
'HBusOut 0 'LowByte R/W#=0
HBReStart 'Send a Restart condition
HBusOut $A7 'All Pixels ON
DelayMS 1000
HBusOut $A6 'All Pixels OFF
DelayMS 1000
HBusOut 0xAE 'Display OFF
HBStop
GoTo Ini
End
Edit Post
Reply
Reply With Quote
+ Reply to Thread
« Previous Thread | Next Thread »
Thread Information
Bookmarks