fenddder Postat Septembrie 1, 2012 Partajează Postat Septembrie 1, 2012 Salutare! M-am apucat sa construiesc un bord digital pentru motocicleta. Am achizitionat un display LCD 128x64 de la Farnell(http://www.farnell.com/datasheets/1485458.pdf si AVR-ul il aveam. Linia de configurare a lcd-ului este putin greoaie in Bascom. Acesta e exemplul din Help: Config Graphlcd = 128*64 , Dataport = Porta , Controlport = Portc , Ce = 2 , Cd = 3 , Wr = 0 , Rd = 1 , Reset = 4 , Fs = 5 , Mode = 8 Problema este ca LCD-ul achizitionat are doar pinii: Enable, R/W, D/I, CS1, CS2, RSTB ca si conexiuni de control. Cum trebuie setat in program? Link spre comentariu
fenddder Postat Septembrie 1, 2012 Autor Partajează Postat Septembrie 1, 2012 Salutare! M-am apucat sa construiesc un bord digital pentru motocicleta. Am achizitionat un display LCD 128x64 de la Farnell(http://www.farnell.com/datasheets/1485458.pdf si AVR-ul il aveam. Linia de configurare a lcd-ului este putin greoaie in Bascom. Acesta e exemplul din Help: Config Graphlcd = 128*64 , Dataport = Porta , Controlport = Portc , Ce = 2 , Cd = 3 , Wr = 0 , Rd = 1 , Reset = 4 , Fs = 5 , Mode = 8 Problema este ca LCD-ul achizitionat are doar pinii: Enable, R/W, D/I, CS1, CS2, RSTB ca si conexiuni de control. Cum trebuie setat in program? -Ce= Enable -Wr= R/W -RSTB= Reset -Cd= D/I -Rd= R/W -Fs= ??? (asta nu e necesar oricum pentru ca displayul e de tip SED)In bascom se cere pin de Read individual fata de pinul de Write insa pe conectorul displayului este un singur pin Read/Write. In concluzie pot pune : Wr=W/R;Rd=W/R???? Link spre comentariu
vasile eugen Postat Septembrie 1, 2012 Partajează Postat Septembrie 1, 2012 Uite niste puncte de pornire: http://jormungand.net/projects/devices/avrlcd/ http://extremeelectronics.co.in/avr-tut ... h-avr-mcu/ Mai exact aici: http://www.mikrocontroller.net/topic/161053 http://avrprojects.net/index.php?option ... &Itemid=57 http://www.rn-wissen.de/index.php/Bascom Link spre comentariu
danzup Postat Septembrie 2, 2012 Partajează Postat Septembrie 2, 2012 Uite aici cum sa iti scrii propriul cod ca sa te interfatezi cu astfel de afisaje grafice (e ceva vreme de cand nu mai folosesc rutinele de IR , LCD si inca cateva din Bascom PENTRU CA NU IMI OFERA FLEXIBILITATEA DE care am nevoie ). Programul acesta nu este scris de mine . Daca stii Bascom vei sti cum sa inglobezi aceste idei in programul tau.De asemenea acest program deseneaza cateva chestii dragute , iti dai seama ca acelea trebuie inlaturate daca vrei sa folosesti in programul tau .'---------------------Alexander D.--------------------------------------------------------------------------'Working code for graphic LCD 128 x 64 to the controller ST7920, model JN12864J V1.2'Connect the 8-bit bus, data lines on PORTB, rest of lines you find in programm'Output Psb connect to positive supply (via a resistor 1K) - is the choice of parallel bus'The body of the code, there are two accesses to the port directly, consider the remapping in case of 'modification'For AVR ATMEGA8$regfile = "m8def.dat"$crystal = 8000000$hwstack = 32$swstack = 20$framesize = 40Declare Sub Lcdstart ()Declare Sub Lcdimgcls ()Declare Sub Lcdcommand (ir As Byte)Declare Sub Lcdwrite (dr_en As Byte)Declare Function Lcdget () As ByteDeclare Sub Showstr (zf As String)Declare Sub Point (x As Byte, Y As Byte)Declare Sub Lcdline (px1 As Byte, Py1 As Byte, Px2 As Byte, Py2 As Byte)Declare Sub Lcdcircle (px1 As Byte, Py1 As Byte, Rcircle As Byte)Outport Alias PortbGetport Alias PinbConfig Outport = OutputRs Alias Portc.4 'H: Data L: Instruction CodeConfig Rs = OutputRw Alias Portc.3 'H: Read L: WriteConfig Rw = OutputE Alias Portc.2Config E = OutputRst Alias Portc.0Config Rst = OutputDim Mybyte As ByteDim Myword As WordDim Lcdstr As String * 32Dim Lcdx As Byte, Lcdy As ByteDim Pstx As Byte, Psty As ByteDim Xx1 As Byte, Yy1 As Byte, Xx2 As Byte, Yy2 As ByteDim K As Single, Mysingle As SingleDim Dx As Integer, Dy As IntegerDim X As Byte, Y As ByteDim Xi As Byte, Yi As ByteDim Xadrs As Byte, Yadrs As Byte, Xpos As ByteDim Byteh As Byte, Bytel As ByteConst Pi = 3.1416 Call Lcdstart Mybyte = &B_1001_1000 : Lcdcommand Mybyte Lcdstr = "ST7920.BascomAvr": Showstr Lcdstr Mybyte = &B_0011_0100 : Lcdcommand Mybyte 'EXTENDEN instruction Mybyte = &B_0011_0110 : Lcdcommand Mybyte 'GRAGIC display On Call Lcdimgcls Psty = 0 For Pstx = 0 To 127 Point Pstx, Psty Next Pstx = 0 For Psty = 0 To 63 Point Pstx, Psty Next Pstx = 127 For Psty = 0 To 63 Point Pstx, Psty Next Psty = 63 For Pstx = 0 To 127 Point Pstx, Psty Next Pstx = 35: Psty = 17: Mybyte = 15 Lcdcircle Pstx, Psty, Mybyte Pstx = 66: Psty = 17: Mybyte = 15 Lcdcircle Pstx, Psty, Mybyte Pstx = 97: Psty = 17: Mybyte = 15 Lcdcircle Pstx, Psty, Mybyte Pstx = 50: Psty = 34: Mybyte = 15 Lcdcircle Pstx, Psty, Mybyte Pstx = 81: Psty = 34: Mybyte = 15 Lcdcircle Pstx, Psty, Mybyte Xx1 = 0: Yy1 = 49: Xx2 = 127: Yy2 = 49 Lcdline Xx1, Yy1, Xx2, Yy2Wait 2 Xx1 = 0: Yy1 = 0: Xx2 = 127: Yy2 = 49 Lcdline Xx1, Yy1, Xx2, Yy2 Xx1 = 0: Yy1 = 49: Xx2 = 127: Yy2 = 0 Lcdline Xx1, Yy1, Xx2, Yy2EndSub Lcdstart () Reset Rst: Waitms 50: Set Rst Reset Rw Reset E Waitms 50 Mybyte = &B_0011_0000 : Lcdcommand Mybyte : Waitms 150 'Set 8-bit interface Mybyte = &B_0011_0000 : Lcdcommand Mybyte Mybyte = &B_0000_0001 : Lcdcommand Mybyte 'Clear Display Waitms 2 Mybyte = &B_0000_0110 : Lcdcommand Mybyte 'Entry Mode Set Mybyte = &B_0000_1100 : Lcdcommand Mybyte 'Control DisplayEnd SubFunction Lcdget () as Byte E = 0: Rs = 1: Rw = 1 E = 1 Config Outport = Input 'Input nop Lcdget = Getport 'Read nop E = 0 Rw = 0 Waitus 80 Config Outport = OutputEnd FunctionSub Lcdcommand (ir As Byte) E = 0 Rs = 0 E = 1 nop Outport = Ir nop E = 0 Waitus 80End SubSub Lcdwrite (dr_en As Byte) E = 0 Rs = 1 E = 1 nop Outport = Dr_en nop E = 0 Waitus 80End SubSub Showstr (zf As String) Local T As Byte, I As Byte, Zf1 As String * 1 Zf = Format (zf, "00") For T = 1 To Len (zf) Zf1 = Mid (zf, T, 1) I = Asc (zf1) Lcdwrite I NextEnd SubSub Lcdimgcls () Mybyte = &H00 For Lcdx = &H80 To &B10001111 For Lcdy = &H80 To &B10011111 Lcdcommand Lcdy Lcdcommand Lcdx Lcdwrite Mybyte Lcdwrite Mybyte Next NextEnd SubSub Point(x As Byte , Y As Byte) Xadrs = X \ 16 Xpos = X Mod 16 Yadrs = Y \ 32 Yadrs = Yadrs * 8 Xadrs = Xadrs + Yadrs Yadrs = Y Mod 32 Xadrs = Xadrs + &H80 Yadrs = Yadrs + &H80 Lcdcommand Yadrs Lcdcommand Xadrs Byteh = Lcdget () Byteh = Lcdget () Bytel = Lcdget () If Xpos <8 Then Xpos = 7 - Xpos Xpos = 2 ^ Xpos Byteh = Byteh Or Xpos Else Xpos = 15 - Xpos Xpos = 2 ^ Xpos Bytel = Bytel Or Xpos End If Lcdcommand Yadrs Lcdcommand Xadrs Lcdwrite Byteh Lcdwrite BytelEnd SubSub Lcdline (px1 As Byte, Py1 As Byte, Px2 As Byte, Py2 As Byte) Dy = Py2 - Py1: Dx = Px2 - Px1 If Dy = 0 And Dx = 0 Then Point Px1, Py1 Exit Sub End If If Dy = 0 Then If Px1> Px2 Then For X = Px1 To Px2 Step -1 Point X, Py1 Next Else For X = Px1 To Px2 Step 1 Point X, Py1 Next End If Exit Sub End If If Dx = 0 Then If Py1> Py2 Then For Y = Py1 To Py2 Step -1 Point Px1, Y Next Else For Y = Py1 To Py2 Step 1 Point Px1, Y Next End If Exit Sub End If Xi = Abs (dx): Yi = Abs (dy) If Xi> Yi Then K = Dy / Dx If Px1> Px2 Then For X = Px1 To Px2 Step -1 Yi = X - Px1 Yi = K * Yi Y = Py1 + Yi Point X, Y Next Else For X = Px1 To Px2 Step 1 Yi = X - Px1 Yi = K * Yi Y = Py1 + Yi Point X, Y Next End If Else K = Dx / Dy If Py1> Py2 Then For Y = Py1 To Py2 Step -1 Xi = Y - Py1 Xi = K * Xi X = Px1 + Xi Point X, Y Next Else For Y = Py1 To Py2 Step 1 Xi = Y - Py1 Xi = K * Xi X = Px1 + Xi Point X, Y Next End If End IfEnd SubSub Lcdcircle (px1 As Byte, Py1 As Byte, Rcircle As Byte) For Myword = 0 To 359 Step 2 Mysingle = Myword K = Deg2rad (mysingle) Mysingle = Sin (k) Mysingle = Mysingle * Rcircle Xx1 = Mysingle + Px1 Mysingle = Cos(k) Mysingle = Mysingle * Rcircle Yy1 = Mysingle + Py1 Point Xx1, Yy1 NextEnd Sub Link spre comentariu
Vizitator rainy Postat Octombrie 1, 2017 Partajează Postat Octombrie 1, 2017 here is bascom file LCD.rar Link spre comentariu
nico_2010 Postat Octombrie 2, 2017 Partajează Postat Octombrie 2, 2017 Cel mai probabil userul si-a rezolvat problema dupa 5 ani!!! Link spre comentariu
Postări Recomandate
Creează un cont sau autentifică-te pentru a adăuga comentariu
Trebuie să fi un membru pentru a putea lăsa un comentariu.
Creează un cont
Înregistrează-te pentru un nou cont în comunitatea nostră. Este simplu!
Înregistrează un nou contAutentificare
Ai deja un cont? Autentifică-te aici.
Autentifică-te acum