danzup Postat Martie 28, 2013 Partajează Postat Martie 28, 2013 Am trecut asa dar cind foloseam foloseam doar unul,iar cel nefolosit il puneam in virgula.Este un display model PG240128A-PC unul cu care am facut probe mai mult.Am mai testat cu coduri si imi da literile taiate.De pe aici m-am documentat:http://www.powertipusa.com/pdf/pg240128a.pdfhttp://www.turbokeu.com/mycomputer/glcd/glcd.pdfhttp://www.mikrocontroller.net/topic/8236ceva mai concret nu am gasit.Pai e T6963C care e suportat de catre Bascom:The first chip supported was T6963C. There are also driver for other LCD's such as SED and KS0108. The most popular LCD's will be supported with a custom driver. The following connections were used for the T6963C:PORTA.0 to PORTA.7 to DB0-DB7 of the LCDPORTC.5 to FS, font select of LCDPORTC.2 to CE, chip enable of LCDPORTC.3 to CD, code/data select of LCDPORTC.0 to WR of LCD, writePORTC.1 to RD of LCD, readPORTC.4 to RESET of LCD, reset LCDThe LCD used from www.conrad.de needs a negative voltage for the contrast. Two 9V batteries were used with a pot meter.Some displays have a Vout that can be used for the contrast(Vo) The T6963C displays have both a graphical area and a text area. They can be used together. The routines use the XOR mode to display both text and graphics layered over each other. Foarte important : in cod sa treci prima data Cls si apoi Cursor Off sau comenteaza cursor off in codul tau si zi cum merge. Link spre comentariu
vasile eugen Postat Martie 29, 2013 Partajează Postat Martie 29, 2013 Revin din nou cu codul care este pus si imi sunt taiate din litere:$regfile = "m32def.DAT"'$crystal = 7372800$crystal = 8000000$baud = 19200$hwstack = 100$swstack = 120$framesize = 100Config Graphlcd = 240 * 128 , Dataport = Porta , Controlport = Portc , Ce = 2 , Cd = 3 , Wr = 0 , Rd = 1 , Reset = 4 , Fs = 5 , Mode = 6Cursor OffClsDeclare Sub Lcdtext(byval S As String , Byval Xoffset As Byte , Byval Yoffset As Byte , Byval Fontset As Byte , Byval Inverse As Byte , Byval Rotation As Byte)'SYNTAX Lcdtest String , Xoffset , Yoffset , Fontset , Inverse , Rotation''* Xoffset and Yoffset is in pixels, so you can place text on every spot on the display'* You determin yourself in the subroutine witch font belongs to the fontset'=== Your main prog here ====Do'Lcdtext "5X5 Font" , 10 , 2 , 4 , 0 , 0'Lcdtext "8X8 Font" , 2 , 120 , 2 , 1 , 3Lcdtext "8X8 font" , 10 , 30 , 2 , 0 , 0'Lcdtext "6X8 Font" , 10 , 20 , 3 , 0 , 0'Lcdtext "16X16 font" , 10 , 30 , 2 , 0 , 0'Lcdtext "Inverted" , 10 , 85 , 2 , 1 , 0'Lcdtext "If you can't read this then incr. Swstack" , 1 , 120 , 4 , 0 , 0Wait 10Cls'Lcdtext "0 deg.Rotation" , 10 , 10 , 1 , 0 , 0Lcdtext "90 deg.Rotation" , 170 , 1 , 1 , 0 , 1'Lcdtext "180 deg.Rotation" , 120 , 20 , 1 , 0 , 2'Lcdtext "270 deg.Rotation" , 200 , 120 , 1 , 0 , 3'Lcdtext "Also inverted" , 150 , 80 , 1 , 1 , 2'Lcdtext "Every font" , 150 , 100 , 2 , 0 , 2Wait 10ClsLoopEnd'=== Sub Routines ===Sub Lcdtext(byval S As String , Xoffset As Byte , Yoffset As Byte , Fontset As Byte , Inverse As Byte , Rotation As Byte)Local Tempstring As String * 1 , Temp As Byte 'Dim local the variablesLocal A As Byte , Pixels As Byte , Count As Byte , Carcount As Byte , Lus As ByteLocal Row As Byte , Byteseach As Byte , Blocksize As Byte , Dummy As ByteLocal Colums As Byte , Columcount As Byte , Rowcount As Byte , Stringsize As ByteLocal Xpos As Byte , Ypos As Byte , Pixel As Byte , Pixelcount As ByteIf Inverse > 1 Then Inverse = 0 'Inverse can't be greater then 1If Rotation > 3 Then Rotation = 0 'There are only 4 rotation'sStringsize = Len(s) - 1 'Size of the text string -1 because we must start with 0For Carcount = 0 To Stringsize 'Loop for the numbers of caracters that must be displayed If Fontset = 1 Then Restore Font8x8 'Add or remove here fontset's that you need or not, If Fontset = 2 Then Restore Font8x8 'this is the name that you gave to the font, NOT the filename If Fontset = 3 Then Restore Font8x8 'If you dont know the name, open the font file in wordpad, and there it is, If Fontset = 4 Then Restore Font8x8 'right on top. Temp = Carcount + 1 'Cut the text string in seperate caractersTempstring = Mid(s , Temp , 1)Read Row : Read Byteseach : Read Blocksize : Read Dummy 'Read the first 4 bytes from the font fileTemp = Asc(tempstring) - 32 'Font files start with caracter 32For Lus = 1 To Temp 'Do dummie read to point to the correct line in the fontfile For Count = 1 To Blocksize Read Pixels Next CountNext LusColums = Blocksize / Row 'Calculate the numbers of columsRow = Row * 8 'Row is always 8 pixels high = 1 byte, so working with row in steps of 8.Row = Row - 1 'Want to start with row=0 instead of 1Colums = Colums - 1 'Same for the columsSelect Case Rotation Case 0 '0 degrees rotation For Rowcount = 0 To Row Step 8 'Loop for numbers of rows A = Rowcount + Yoffset For Columcount = 0 To Colums 'Loop for numbers of Colums Read Pixels : If Inverse = 1 Then Toggle Pixels 'Read the byte from the file and if inverse = true then invert de byte Xpos = Columcount 'Do some calculation to get the caracter on the correct Xposition Temp = Carcount * Byteseach Xpos = Xpos + Temp Xpos = Xpos + Xoffset For Pixelcount = 0 To 7 'Loop for 8 pixels to be set or not Ypos = A + Pixelcount 'Each pixel on his own spot Pixel = Pixels.0 'Set the pixel (or not) Pset Xpos , Ypos , Pixel 'Finaly we can set the pixel Shift Pixels , Right 'Shift the byte 1 bit to the right so the next pixel comes availible Next Pixel Next Columcount Next Rowcount Case 1 '90 degrees rotation For Rowcount = Row To 0 Step -8 'Loop is now counting down A = Rowcount + Xoffset A = A - 15 'Correction to set Xpos on Xoffset with rotation For Columcount = 0 To Colums Read Pixels : If Inverse = 1 Then Toggle Pixels Xpos = Columcount Temp = Carcount * Byteseach Xpos = Xpos + Temp Xpos = Xpos + Yoffset 'We want that Xoffset is still Xoffset, so we need here the change from x to y For Pixelcount = 7 To 0 Step -1 Ypos = A + Pixelcount Pixel = Pixels.0 Pset Ypos , Xpos , Pixel Shift Pixels , Right Next Pixel Next Columcount Next Rowcount Case 2 '180 degrees rotation For Rowcount = Row To 0 Step -8 A = Rowcount + Yoffset A = A - 7 'Correction to set Xpos on Xoffset with rotation For Columcount = Colums To 0 Step -1 Read Pixels : If Inverse = 1 Then Toggle Pixels Xpos = Columcount Temp = Carcount * Byteseach Xpos = Xpos - Temp Xpos = Xpos - 8 'Correction to set Xpos on Xoffset with rotation Xpos = Xpos + Xoffset For Pixelcount = 7 To 0 Step -1 Ypos = A + Pixelcount Pixel = Pixels.0 Pset Xpos , Ypos , Pixel Shift Pixels , Right Next Pixel Next Columcount Next Rowcount Case 3 '270 degrees rotation For Rowcount = 0 To Row Step 8 A = Rowcount + Xoffset For Columcount = Colums To 0 Step -1 Read Pixels : If Inverse = 1 Then Toggle Pixels Xpos = Columcount Temp = Carcount * Byteseach Xpos = Xpos - Temp Xpos = Xpos - 8 'Correction to set Xpos on Xoffset with rotation Xpos = Xpos + Yoffset For Pixelcount = 0 To 7 Ypos = A + Pixelcount Pixel = Pixels.0 Pset Ypos , Xpos , Pixel Shift Pixels , Right Next Pixel Next Columcount Next RowcountEnd SelectNext CarcountEnd Sub 'End of this amazing subroutine'=== Includes ===$include "Font8x8.font" 'Includes here your font files'$include "Font16x16.font" 'If you don't need the files in your program, don't include them,'$include "Font6x8.font" 'these are flash memory eaters.'$include "Font5x5.font" Link spre comentariu
danzup Postat Martie 29, 2013 Partajează Postat Martie 29, 2013 Revin din nou cu codul care este pus si imi sunt taiate din litere: Config Graphlcd = 240 * 128 , Dataport = Porta , Controlport = Portc , Ce = 2 , Cd = 3 , Wr = 0 , Rd = 1 , Reset = 4 , Fs = 5 , Mode = 6 Cls Cls Cursor Off Cls Uite ce ziceam eu sa faci ! Link spre comentariu
vasile eugen Postat Martie 29, 2013 Partajează Postat Martie 29, 2013 tot asa imi da si am incercatsi sa pun:Config Graphlcd = 240 * 128 , Dataport = Porta , Controlport = Portc , Ce = 2 , Cd = 3 , Wr = 0 , Rd = 1 , Reset = 4 , Fs = 5 , Mode = 6ClsClsClsClsCursor OffCls Link spre comentariu
costyy86 Postat Martie 29, 2013 Partajează Postat Martie 29, 2013 Revin si eu cu o intrebare...Cum pot denumi o functie ADC in asa fel incat acea functie sa fie activata doar la apasarea unui buton...Stiu cum sa configurez butonul, dar nu stiu cum si ce denumire trebuie sa dau spre exemplu unui voltmetru care este pe ADC.0, sa fie afisat doar cand este apasat butonul (buton cu retinere).... Link spre comentariu
iulian2010 Postat Martie 30, 2013 Partajează Postat Martie 30, 2013 Salut! '$sim$regfile = "m8def.dat"$crystal = 1000000 '$crystal = 8000000$hwstack = 32$swstack = 10$framesize = 40Config Lcd = 16 * 2Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.1 , Rs = Portd.0Cursor Off NoblinkClsConfig Portd.2 = OutputConfig Portd.3 = OutputConfig Portc.2 = InputSet Portc.2Buton Alias Pinc.2Dim Adcv0 As Word , Volt0 As SingleDim Adcv1 As WordConst Dif = 5 / 1024Const Volt_div = 1Config Adc = Single , Prescaler = Auto , Reference = AvccStart AdcDoAdcv0 = Getadc(0)Volt0 = Adcv0 * DifVolt0 = Volt0 / Volt_div Select Case Adcv0 Case 0 To 72: Portd.2 = 0 Case 73 To 1023: Portd.2 = 1 End Select If Buton = 0 Then Locate 1 , 1 Lcd "Tensiune= " Locate 1 , 11 Lcd Fusing(volt0 , "##.#") ; " V" Else Locate 1 , 1 Lcd " costyy86 " 'sau nu afisezi nimic Lcd " " End IfAdcv1 = Getadc(1) Select Case Adcv1 Case 0 To 72: Portd.3 = 0 Case 73 To 1023: Portd.3 = 1 End SelectLoopEnd Link spre comentariu
costyy86 Postat Martie 31, 2013 Partajează Postat Martie 31, 2013 Multumesc Iulian.mi-a fost de mare ajutor, am studiat codul si am incercat usor sa il modific, insa ma-m blocat undeva... Vreu ca la apasarea butoanelor simultam "Buton + Buton1", sa dispara textele aferente acestora "TEXT 1 respectiv TEXT 2", si sa apara "TEXT 3" se poate? Codul modificat mai jos... '$sim$regfile = "m8def.dat"$crystal = 1000000 '$crystal = 8000000$hwstack = 32$swstack = 10$framesize = 40Config Lcd = 16 * 2Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.1 , Rs = Portd.0Cursor Off NoblinkClsConfig Portd.2 = OutputConfig Portd.3 = OutputConfig Portc.2 = InputConfig Portc.3 = InputSet Portc.2Set Portc.3Buton Alias Pinc.2Buton1 Alias Pinc.3Dim Adcv0 As Word , Volt0 As SingleDim Adcv1 As WordConst Dif = 5 / 1024Const Volt_div = 1Config Adc = Single , Prescaler = Auto , Reference = AvccStart AdcDoAdcv0 = Getadc(0)Volt0 = Adcv0 * DifVolt0 = Volt0 / Volt_div Select Case Adcv0 Case 0 To 72: Portd.2 = 0 Case 73 To 1023: Portd.2 = 1 End Select If Buton = 0 Then Locate 1 , 1 Lcd " TEXT 1 " If Buton = 1 ThenLocate 1 , 1Lcd " " End If End If If Buton1 = 0 Then Locate 1 , 1 Lcd " TEXT 2 " If Buton1 = 1 Then Locate 1 , 1 Lcd " " End If End IfAdcv1 = Getadc(1) Select Case Adcv1 Case 0 To 72: Portd.3 = 0 Case 73 To 1023: Portd.3 = 1 End SelectLoopEnd Link spre comentariu
iulian2010 Postat Martie 31, 2013 Partajează Postat Martie 31, 2013 Codul nu este testat hardware '$sim$regfile = "m8def.dat"$crystal = 1000000 '$crystal = 8000000$hwstack = 32$swstack = 10$framesize = 40Config Lcd = 16 * 2Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.1 , Rs = Portd.0Cursor Off NoblinkClsConfig Portd.2 = OutputConfig Portd.3 = OutputConfig Portc.2 = InputConfig Portc.3 = InputSet Portc.2Set Portc.3Buton Alias Pinc.2Buton1 Alias Pinc.3Dim Adcv0 As Word , Volt0 As SingleDim Adcv1 As WordConst Dif = 5 / 1024Const Volt_div = 1Config Adc = Single , Prescaler = Auto , Reference = AvccStart AdcDoAdcv0 = Getadc(0)Volt0 = Adcv0 * DifVolt0 = Volt0 / Volt_div Select Case Adcv0 Case 0 To 72: Portd.2 = 0 Case 73 To 1023: Portd.2 = 1 End Select If Buton = 1 And Buton1 = 1 Then Locate 1 , 1 Lcd " " End If If Buton = 0 And Buton1 = 1 Then Locate 1 , 1 Lcd " TEXT 1 " End If If Buton1 = 0 And Buton = 1 Then Locate 1 , 1 Lcd " TEXT 2 " End If If Buton = 0 And Buton1 = 0 Then Locate 1 , 1 Lcd " TEXT 3 " End IfAdcv1 = Getadc(1) Select Case Adcv1 Case 0 To 72: Portd.3 = 0 Case 73 To 1023: Portd.3 = 1 End SelectLoopEnd Link spre comentariu
costyy86 Postat Aprilie 1, 2013 Partajează Postat Aprilie 1, 2013 Multumesc Iulian, am rezolvat problema... Link spre comentariu
costyy86 Postat Aprilie 2, 2013 Partajează Postat Aprilie 2, 2013 Cum pot scrie un cod pentru a citi o tensiune negativa? Link spre comentariu
yo9hnf Postat Aprilie 10, 2013 Autor Partajează Postat Aprilie 10, 2013 Am o problema cu o treaba aparent banala...Am o variabila Word:x=getadc(0)lcd "lolo"; xDaca variez tensiunea la intrarea ADC0, pe LCD mi se afiseaza initial valoarea variabilei pana la 1023.Daca scad tensiunea, din 1023, de exemplu 8003 - adica 800 si mai ramane 3 din 1023, sau 7803 - adica 78 si 03 anterior.Unde este bug-ul ? Link spre comentariu
iulian2010 Postat Aprilie 10, 2013 Partajează Postat Aprilie 10, 2013 Incearca asa: Config Lcd = 16 * 2Config Lcdpin = Pin , Db4 = Portd.4 , Db5 = Portd.5 , Db6 = Portd.6 , Db7 = Portd.7 , E = Portd.1 , Rs = Portd.0Cursor Off Noblinkx=getadc(0) Locate 1 , 1 Lcd "lolo= " Locate 1 , 7 Lcd Fusing(x , "##.#") ; " " sau Lcd "lolo " ; x ; " " Edit: La primul exemplu se afiseaza tensiunea de intrare pe ADC0: Const Dif = 5 / 1024Const Volt_div = 1X = Getadc(0)Volt = X * DifVolt = Volt / Volt_div Locate 1 , 1 Lcd "lolo= " Locate 1 , 7 Lcd Fusing(volt , "##.#") ; " " si asa afiseaza conversia numerica: Locate 1 , 1Lcd "lolo " ; x ; " " Link spre comentariu
yo9hnf Postat Aprilie 11, 2013 Autor Partajează Postat Aprilie 11, 2013 Am incercat sintaxa cu LCD FUSING ca mai sus, dar imi da eroare :"Single Expected..." , exact la linia cu LCD FUSING.Inca o problema as mai avea:Trebuie sa comand un uC sa faca ceva atunci cand primeste un semnal exterior.Semnalul exterior vine de la un generator de semnal pe care il pot programa in fel si chip. Ma gandeam sa generez niste impulsuri dreptunghiulare de 1V, 2V, 3V (cu delay de milisecunde intre ele) de exemplu (sau o combinatie asemanatoare) pe care uC-ul sa o vada. Este viabil ? Cum as putea implementa asta in soft ? Link spre comentariu
iulian2010 Postat Aprilie 11, 2013 Partajează Postat Aprilie 11, 2013 Declara variabila Volt Dim Volt as Single. Am gasit mai demult un proiect care citea semnale dreptunghiulare. Acum sunt in delegatie si scriu de pe telefon. Cand ajung la hotel o sa-l caut. Link spre comentariu
yo9hnf Postat Aprilie 11, 2013 Autor Partajează Postat Aprilie 11, 2013 Multumesc iulian2010! Ai avut dreptate, trebuia declarata o variabila ca single. Merge folosit si decat asa:Lcd Fusing(variabila , "##.&") ' afiseaza un zero dupa punctsau asa:Lcd Fusing(variabila , "##.")Este aiurea ca nu poti scapa de punct....oricum, e un lucru insignifiant. Poate gasesti (nu e graba) modul de citire al semnalelor dreptunghiulare. 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