Sari la conținut
ELFORUM - Forumul electronistilor

Afisare text mare pe un lcd graphic cod bascom si numarator!


Cilibiu

Postări Recomandate

Pini iam conectat cum era conectati in arhiva lui iulian, oricum nu are inmportanta deoarece proteusul stie sa il alimenteze corect, eu il alimentasem in felul urmator si acelasi lucru rezulta , adik nu merge, 1 masa ,2 la 5V si 3 la masa!Poza mai jos ca merge si asa conectat dar cu atmega 128Imi cer scuze, tot scriu FOND in loc de FONT!

post-15533-139829290544_thumb.jpg

Link spre comentariu
  • Răspunsuri 73
  • Creat
  • Ultimul Răspuns

Top autori în acest subiect

  • Cilibiu

    36

  • iulian2010

    17

  • Liviu M

    16

  • francezu

    2

Top autori în acest subiect

Imagini postate

In cazul asta (merge cu un controller da' nu cu altul), presupun ca cel care merge are configuratia default (de reset) diferita de cea a celui care nu merge. Ramane sa descoperi ce difera si sa modifici configuratia respectiva (de ex. confgurarea porturilor - portul A poate fi folosit de modulul ADC; daca la alimentare 8535 porneste cu portul A setat pe ADC, atunci codul tau nu va merge).Din pacate nu am lucrat deloc cu atmeluri, asa ca nu te pot sfatui mai departe. Poate reuseste vreun "atmelist" mai bazat sa te ajute.LE Cred ca sunt pe directia buna:Din data-sheetul lui 8535

Port A serves as the analog inputs to the A/D Converter.Port A also serves as an 8-bit bi-directional I/O port, if the A/D Converter is not used.

atmega128

Port A is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit)....Port A also serves the functions of various special features of the ATmega128 as listed on page 72.

Mie din documentatiile astea imi iese ca portul a la primul e default analog, la cel de-al doilea digital.
Link spre comentariu

Cred ca ai dreptate, am inversat porturile de la 8535 in toate felurile si nu vrea sa mearga, deci trebuie sa caut un atmega care sa fie in capsula DIP si sa imi mearga comunicatia cu lcd-ul graphic.Acum os a inversez porturile doar de proba la 128 sa vad daca se comporta la fel ca 8535!L.E. Am modificat porturile si tot merge, am folosit port-ul F care este ADC lam folosit pentru DATA iar portul D lam folosit ca CONTROL, si functioneaza normal in simulare!Ramane varianta ca difera de la MCU la MCU nu la PORTURI!

Link spre comentariu

Sa zicem ca deocamdata am schimbat controlerul si folosesc atmega128.

Cu textul mam lamurit, dar cum fac ca sa afisez o valoare citita pe un anumit port, de exemplu cum este voltmetru, ca sa afisez pe un lcd 2x16 scriu

Locate 1,1Lcd fusing (volt, "#.#")
Dar pe un lcd graphic ca sa afisez "VOLT" ca marime 16x16, cum fac?

Ma gandesc la urmatoarea varianta:

Lcd fusing (volt, "#.#")Lcdtext "volt" , 10 , 30 , 2 , 0 , 0
Oare ar merge?

Ce varianta stiti voi?

Link spre comentariu

Din link ajunge in alt link care insereaza o imagine ce scrie MC Electronics, ceva de genul, ce am intrebat eu mai sus e cu totul altceva. Sa afisez texte normale, lini , patrate sau orice altceva stiu ce se bazeaza pe randurile lui normale, ce nu stiam sa fac este cu acel font, marime mai mare, acum am invatat dar am ajuns acolo unde citesc o valoare pe un port si vreau sa fie afisat tot de marime mare!De exemplu sa fac un voltmetru care sa arate cat tot ecranul valoarea citita, folosesc portul ADC0 ca intrare , citesc valoarea de pe port adik "volt".La lcd normal comanda era simpla:Locate 1,1Lcd fusing (volt, "#.#")Si aparea pe primul rand valoarea citita, si aici merge dar apare tot pe primul rand, eu vreau sa apara cat tot ecranul sau in marime 16x16.Am zis si mai sus la ce comanda ma gandesc!Lcd fusing (volt, "#.#")Lcdtext "volt" , 10 , 30 , 2 , 0 , 0

Link spre comentariu

Nimeni nimik?

Am incercat ce am zis eu si nu merge, mam documentat din help si nu am gasit nimik.

Deci valoarea citita pe portul ADC0 sa fie afisat 16x16, asta ca sa inteleaga toti ce vreau!

Inca mai caut optiuni!

 

L.E. Ma gandeam la urmatoarea comanda, dar imi zice ca ni definit bine "volt"

Deci volt este definit SINGLE, asa merge afisat cu comanda "LCD volt".

Acum vreau sa implementez in comanda cu Lcdtext "text",10,10,1,0,0 care rezulta Lcdtext volt,10,10,1,0,0 dar imi zice ca nui bine definit "volt", cum trebuie sa il definesc ca sa il pot afisa cum trebuie?

Codul de la voltmetru:

Dim Adcv As Word , Volt As SingleConst Dif = 5 / 1024Const Volt_div = 0.01Config Adc = Single , Prescaler = Auto , Reference = AvccStart AdcClsDoAdcv = Getadc(0)                                            ' 0 = ADC0   Waitms 50   'Calcul   Volt = Adcv * Dif   Volt = Volt / Volt_divlocate 1,1Lcd voltloopend
iar eu vroiam sa adaug doar comanda urmatoare:

Declare 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)Dim Adcv As Word , Volt As SingleConst Dif = 5 / 1024Const Volt_div = 0.01Config Adc = Single , Prescaler = Auto , Reference = AvccStart AdcClsDoAdcv = Getadc(0)                                            ' 0 = ADC0   Waitms 50   'Calcul   Volt = Adcv * Dif   Volt = Volt / Volt_div'Lcdtext Volt , 20 , 30 , 1 , 0 , 0LoopEnd'=== 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 ByteStringsize = 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 Font16x16                      '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 Font16x16                      'If you dont know the name, open the font file in wordpad, and there it is, If Fontset = 4 Then Restore Font16x16                      '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 RowcountEnd SelectNext CarcountEnd Sub                                                     'End of this amazing subroutine'=== Includes ===$include "Font16x16.font"                                   'Includes here your font files$include "font8x8.font"
Erorile in bascom sunt urmatoarele:71,242,124

Voi ce ziceti?

Link spre comentariu
$regfile = "m128def.DAT"$crystal = 8000000$baud = 19200$hwstack = 100$swstack = 120$framesize = 100Config Graphlcd = 240 * 128 , Dataport = Porta , Controlport = Portc , Ce = 3 , Cd = 0 , Wr = 2 , 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)Dim Adcv As Word , Volt As SingleConst Dif = 5 / 1024Const Volt_div = 0.01Config Adc = Single , Prescaler = Auto , Reference = AvccStart AdcClsDoAdcv = Getadc(0)                                            ' 0 = ADC0   Waitms 50   'Calcul   Volt = Adcv * Dif   Volt = Volt / Volt_divLcdtext Volt , 20 , 30 , 1 , 0 , 0'locate 1,1'lcd volt   LoopEnd'=== 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 ByteStringsize = 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 Font16x16                      '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 Font16x16                      'If you dont know the name, open the font file in wordpad, and there it is, If Fontset = 4 Then Restore Font16x16                      '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 RowcountEnd SelectNext CarcountEnd Sub                                                     'End of this amazing subroutine'=== Includes ===$include "Font16x16.font"                                   'Includes here your font files$include "font8x8.font"
Link spre comentariu

Nu cred ca merge asa

Lcdtext Volt , 20 , 30 , 1 , 0 , 0
.

 

Ai putea incerca asta

'Locate 1 , 1Lcdtext "8X8 font=" , 10 , 32 , 2 , 0 , 0Locate 5 , 17Lcd Fusing(volt , "#.##")
Link spre comentariu

Prin manualul de la bascom gasit pe intrenet scrie ca

STRActionReturns a string representation of a number.Syntaxvar = STR( x)

Poti sa-l incerci in locul lui Fusing, sa vezi daca reuseti sa convertesti rezultatul in string; am inteles ca pe astea le poti afisa.
Link spre comentariu

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 cont

Autentificare

Ai deja un cont? Autentifică-te aici.

Autentifică-te acum



×
×
  • Creează nouă...

Informații Importante

Am plasat cookie-uri pe dispozitivul tău pentru a îmbunătății navigarea pe acest site. Poți modifica setările cookie, altfel considerăm că ești de acord să continui.Termeni de Utilizare si Ghidări