پاسخ : آموزش گام به گام LCD N96 رنگی و AVR و بسکام
منم همونو نوشتم که درست کار میکنه ولی تو فرکانس 8 مگاهرتز ، شما فیوزبیت و ... رو درست تنظیم کردید ؟ jtag چطور ، خاموشه دیگه ؟
این سورس مال منه که بدون ارور کامپایل میشه و مشکلی هم نداره یه امتحانی بکن ورژن های نادرست bascom خیلی وقتها شده ارور الکی میدن تو کامپایل برنامه ها :
نوشته اصلی توسط invincible
این سورس مال منه که بدون ارور کامپایل میشه و مشکلی هم نداره یه امتحانی بکن ورژن های نادرست bascom خیلی وقتها شده ارور الکی میدن تو کامپایل برنامه ها :
کد:
$regfile = "m32def.dat" $crystal = 8000000 'ÞÓãÊ 1 '-------------------------------------------------------- Config Porta = Output Config Portc = Output 'lsb port Config Portd = Output 'msb port Cs Alias Portd.0 Rs Alias Portd.1 Wr Alias Portd.2 Rd Alias Portd.3 Rst Alias Portd.4 Lsb_port Alias Porta Msb_port Alias Portc Declare Sub Trigerlcd Declare Sub Writedata Declare Sub Writeindex Declare Sub Colorlcd Dim Index As Byte , Dat As Word , Reapet As Long 'ÞÓãÊ 2 '-------------------------------------------------------- Const Start_osc = &H00 Const Driver_output_control = &H01 Const Lcd_driving_wave_control = &H02 Const Entry_mode = &H03 Const Resizing_control = &H04 Const Display_control1 = &H07 Const Display_control2 = &H08 Const Display_control3 = &H09 Const Display_control4 = &H0A Const Rgb_display_interface_control1 = &H0C Const Frame_marker_position = &H0D Const Rgb_display_interface_control2 = &H0F Const Power_control1 = &H10 Const Power_control2 = &H11 Const Power_control3 = &H12 Const Power_control4 = &H13 Const Gram_horizontal_address = &H20 Const Gram_vertical_address = &H21 Const Write_read_data_to_gram = &H22 Const Power_control7 = &H29 Const Frame_rate_and_color_control = &H2B Const Gamma_control1 = &H30 Const Gamma_control2 = &H31 Const Gamma_control3 = &H32 Const Gamma_control4 = &H35 Const Gamma_control5 = &H36 Const Gamma_control6 = &H37 Const Gamma_control7 = &H38 Const Gamma_control8 = &H39 Const Gamma_control9 = &H3C Const Gamma_control10 = &H3D Const Horizontal_start_address = &H50 Const Horizontal_end_address = &H51 Const Vertical_start_address = &H52 Const Vertical_end_address = &H53 Const Gate_scan_control1 = &H60 Const Gate_scan_control2 = &H61 Const Gate_scan_control3 = &H6A Const Partial_image1_display_position = &H80 Const Partial_image1_ram_start_address = &H81 Const Partial_image1_ram_end_address = &H82 Const Partial_image2_display_position = &H83 Const Partial_image2_ram_start_address = &H84 Const Partial_image2_ram_end_address = &H85 Const Panel_interface_control1 = &H90 Const Panel_interface_control2 = &H92 Const Panel_interface_control4 = &H95 Const Color_red = &H001F Const Color_green = &H07E0 Const Color_blue = &HF800 Const Color_yellow = &H07FF Const Color_purple = &HF81F Const Color_black = &H0000 Const Color_white = &HFFFF 'ÞÓãÊ 3 '-------------------------------------------------------- Trigerlcd Colorlcd End 'end program '-------------------------------------------------------- 'ÞÓãÊ 4 Sub Trigerlcd Reset Rst Waitms 60 Set Rst Waitms 200 Index = &H00E3 : Writeindex Dat = &H3008 : Writedata Index = &H00EF : Writeindex Dat = &H1231 : Writedata Index = Start_osc : Writeindex Dat = &H0001 : Writedata Waitms 50 Index = Driver_output_control : Writeindex Dat = &H0100 : Writedata Index = Lcd_driving_wave_control : Writeindex Dat = &H0700 : Writedata Index = Entry_mode : Writeindex Dat = &H0030 : Writedata Index = Resizing_control : Writeindex Dat = &H0000 : Writedata Index = Display_control1 : Writeindex Dat = &H0133 : Writedata Index = Display_control2 : Writeindex Dat = &H0202 : Writedata Index = Display_control3 : Writeindex Dat = &H000F : Writedata Index = Display_control4 : Writeindex Dat = &H0000 : Writedata Index = Rgb_display_interface_control1 : Writeindex Dat = &H0000 : Writedata Index = Frame_marker_position : Writeindex Dat = &H0000 : Writedata Index = Rgb_display_interface_control2 : Writeindex Dat = &H0000 : Writedata Index = Power_control1 : Writeindex Dat = &H0000 : Writedata Index = Power_control2 : Writeindex Dat = &H0000 : Writedata Index = Power_control3 : Writeindex Dat = &H0000 : Writedata Index = Power_control4 : Writeindex Dat = &H0000 : Writedata Waitms 200 Index = Power_control1 : Writeindex Dat = &H17A0 : Writedata Index = Power_control2 : Writeindex Dat = &H0137 : Writedata Waitms 70 Index = Power_control3 : Writeindex Dat = &H0018 : Writedata Waitms 70 Index = Power_control4 : Writeindex Dat = &H1000 : Writedata Index = Power_control7 : Writeindex Dat = &H000B : Writedata Waitms 70 Index = Gram_horizontal_address : Writeindex Dat = &H0000 : Writedata Index = Gram_vertical_address : Writeindex Dat = &H0000 : Writedata Index = Gamma_control1 : Writeindex Dat = &H0101 : Writedata Index = Gamma_control2 : Writeindex Dat = &H0101 : Writedata Index = Gamma_control3 : Writeindex Dat = &H0101 : Writedata Index = Gamma_control4 : Writeindex Dat = &H0101 : Writedata Index = Gamma_control5 : Writeindex Dat = &H0201 : Writedata Index = Gamma_control6 : Writeindex Dat = &H0707 : Writedata Index = Gamma_control7 : Writeindex Dat = &H0707 : Writedata Index = Gamma_control8 : Writeindex Dat = &H0707 : Writedata Index = Gamma_control9 : Writeindex Dat = &H0101 : Writedata Index = Gamma_control10 : Writeindex Dat = &H0201 : Writedata Index = Horizontal_start_address : Writeindex Dat = &H0000 : Writedata Index = Horizontal_end_address : Writeindex Dat = &H00EF : Writedata Index = Vertical_start_address : Writeindex Dat = &H0000 : Writedata Index = Vertical_end_address : Writeindex Dat = &H013F : Writedata Index = Gate_scan_control1 : Writeindex Dat = &H2700 : Writedata Index = Gate_scan_control2 : Writeindex Dat = &H0001 : Writedata Index = Gate_scan_control3 : Writeindex Dat = &H0000 : Writedata Index = Panel_interface_control1 : Writeindex Dat = &H0010 : Writedata Index = Panel_interface_control2 : Writeindex Dat = &H0000 : Writedata Index = Panel_interface_control4 : Writeindex Dat = &H0110 : Writedata Index = Frame_rate_and_color_control : Writeindex Dat = &H0000 : Writedata End Sub 'ÞÓãÊ 5 '-------------------------------------------------------- Sub Writedata Reset Cs Set Rs Set Rd Msb_port = High(dat) Lsb_port = Low(dat) Reset Wr Set Wr Set Cs End Sub 'ÞÓãÊ 6 '-------------------------------------------------------- Sub Writeindex Reset Cs Reset Rs Set Rd Msb_port = &H00 Lsb_port = Index Reset Wr Set Wr Set Cs End Sub 'ÞÓãÊ 7 '-------------------------------------------------------- Sub Colorlcd Index = Horizontal_start_address : Writeindex Dat = 80 : Writedata Index = Horizontal_end_address : Writeindex Dat = 160 : Writedata Index = Gram_horizontal_address : Writeindex Dat = 80 : Writedata Index = Vertical_start_address : Writeindex Dat = 100 : Writedata Index = Vertical_end_address : Writeindex Dat = 200 : Writedata Index = Gram_vertical_address : Writeindex Dat = 100 : Writedata Index = Write_read_data_to_gram : Writeindex For Reapet = 1 To 4000 Dat = Color_yellow Writedata Next Repeat For Reapet = 1 To 4000 Dat = Color_red Writedata Next Repeat End Sub














دیدگاه