Új hozzászólás Aktív témák
-
#90088192
törölt tag
Hello Mindenkinek

Lenne itt egy kis fennforgás és segítséget szeretnek kerni hozza, mert nem jutok dűlőre egymagamban.
A karakter kiíratás amikor elérkezik a határhoz(2X64 képpontból áll a kijelző, amiket külön kell kapcsolgatni, és 8 bit magas a "sor") akkor nem csak térfelet vált hanem nem is tudom mit csinál, kihagyja az első karakter, meg mintha csak egy oszlopnyi szemetet zúdítana a határvonalra

Ez lenne a problémás részlet(a font 6 szeles és 8 magas):
for(x=(charcater_code-32)*6; x<((charcater_code-32)*6)+7; x++) //Decodes the character code and make sure the data is sent by 8 bits
{if(y_offset+(x-(charcater_code-32)*6)<63) //Checks if the character has reached the border of the 2 sides of the screen
{
DISPLAY_RS = 1;
S_DATA_OUT = font6x8[x]; //Sends the data to the screen
strobe_E();
}else{ //If the Character is belong to the right side
lcd_select(1); //If yes selects the the right side
set_y(0); // Resets the offset
set_x(line_select);
DISPLAY_RS = 1;
S_DATA_OUT = font6x8[x]; //Sends the data to the screen
strobe_E();Ez lenne az egesz:
#include "font6x8.h"
#include "screen.h"
#include "membrane.h"
void InitalizePorts_display(void)
{
S_DATA_OUT=0;
S_DATA_IN=0;
DISPLAY_Dir=0;
DISPLAY_CS1=1;
DISPLAY_CS2=1;
DISPLAY_RS=1;
DISPLAY_RW=0;
DISPLAY_EN=0;
/* Command port direction settings */
DISPLAY_CS1_Direction =0 ;
DISPLAY_CS2_Direction =0 ;
DISPLAY_RS_Direction =0 ;
DISPLAY_RW_Direction =0 ;
DISPLAY_EN_Direction =0 ;
DelayUs(100);
}
void lcd_select(int s)
{
if(s==0)
{
DISPLAY_CS1 = 1; //Selects Left side of the screen
DISPLAY_CS2 = 0; //Deselects Right side of the screen
DelayUs(15);
}else if(s==1)
{
DISPLAY_CS1 = 0; //Deselects Left side of the screen
DISPLAY_CS2 = 1; //Selects Right side of the screen
DelayUs(15);
}else{
DISPLAY_CS1 = 1; //Selects Left side of the screen
DISPLAY_CS2 = 1; //Selects Right side of the screen
DelayUs(15);
}
}
void strobe_E(void) //Turns enabling line off/on
{
DelayUs(5);
DISPLAY_EN = 0; //Turns Display Off
DelayUs(5);
DISPLAY_EN = 1; //Turns Display On
DelayUs(5);
}
void set_y(int y) //Set Y coordinate 0-63 on the active side of the screen
{
DISPLAY_RS = 0; //Sets Instruction mode
DelayUs(5);
S_DATA_OUT = (0b01000000+y); //Set Y coordinate
strobe_E();
}
void set_x(int x) //Select one of the 8 bit line out of the 8
{
if(x<=7 && x>=0) // Verify input parameter is in range
{
DelayUs(5);
DISPLAY_RS = 0; //Sets Instruction mode
DelayUs(5);
S_DATA_OUT = 0b10111000+x; //select the desired line from the 8 X 8bit lines
strobe_E();
}else{
MEMBRANE_MUTE=1;
}
}
void dsp_on(void)
{
DISPLAY_RS = 0; //Instruction mode
DelayUs(2);
S_DATA_OUT = 0b00111111; //Turns display controller ON
DelayUs(2);
DISPLAY_EN = 1; //Turns Enable line ON
strobe_E();
}
void clr_scr (int Fill_)
{
int x; int y;
lcd_select(2); //Select both side of the display for quicker action
for(y=0;y<=7;y++)
{
set_y(0); //Set y to 0
set_x(y); //Selects line of writing
for(x=0; x<64; x++)
{
DISPLAY_RS = 1; //Turns Data mode ON
DelayUs(2);
S_DATA_OUT = Fill_; //Send data to the selected line
strobe_E();
}
}
}
void write_char(int line_select, int y_offset, int charcater_code)
{ int x;
if(y_offset>=64 && y_offset<=122) //Check which side of the screen need to be activated
{
lcd_select(1); //if the offset is bigger than 63 than the right side
set_y(y_offset-64); //Set y
set_x(line_select); //Selects line of writing
for(x=(charcater_code-32)*6; x<=((charcater_code-32)*6)+6; x++) //Decodes the character code and make sure the data is sent by 8 bits
{
DISPLAY_RS = 1;
S_DATA_OUT = font6x8[x];
strobe_E();
}
} else if(y_offset<=63 && y_offset>=0) {
lcd_select(0); //selects the left side of the screen
set_y(y_offset); //Set y
set_x(line_select); //Selects line of writing
for(x=(charcater_code-32)*6; x<((charcater_code-32)*6)+7; x++) //Decodes the character code and make sure the data is sent by 8 bits
{if(y_offset+(x-(charcater_code-32)*6)<63) //Checks if the character has reached the border of the 2 sides of the screen
{
DISPLAY_RS = 1;
S_DATA_OUT = font6x8[x]; //Sends the data to the screen
strobe_E();
}else{ //If the Character is belong to the right side
lcd_select(1); //If yes selects the the right side
set_y(0); // Resets the offset
set_x(line_select);
DISPLAY_RS = 1;
S_DATA_OUT = font6x8[x]; //Sends the data to the screen
strobe_E();
}
}
}
else
{
MEMBRANE_MUTE=1;
}
}
void string_out(char* message, float variable, char line, char y_offset)
{
char test[21],i=0,j;
char a[21];
sprintf(a, "%s%f", message, variable);
while(a[i]!='\0') {test[i]=a[i]; i++;}
for(j=0;j<=i-1;j++) write_char(line,y_offset+j*6,test[j]);
}
Új hozzászólás Aktív témák
● olvasd el a téma összefoglalót!
● ha kódot szúrsz be, használd a PROGRAMKÓD formázási funkciót!
- Szomjan halunk, míg az AI dolgozik
- Chieftec-Prohardver nyereményjáték
- Arc Raiders
- Nvidia GPU-k jövője - amit tudni vélünk
- Hosszú premier előzetest kapott az Arknights: Endfield
- Házi barkács, gányolás, tákolás, megdöbbentő gépek!
- AMD Ryzen 9 / 7 / 5 / 3 5***(X) "Zen 3" (AM4)
- Fotók, videók mobillal
- E-roller topik
- Nothing Phone 2a - semmi nem drága
- További aktív témák...
- Szép! HP EliteBook 855 G7 Fémházas Strapabíró Laptop 15,6" -65% AMD Ryzen 3 PRO 4450U 16/256 FHD
- HP 250RG10 3-100U 15 8GB/512 PC (B9YG6ET) Bontatlan (2db)
- Radiomaster TX16S MAX Mark II ELRS táv
- thrustmaster ts pc racer ferrari 488 challenge edition
- HP EliteBook 655 G10 15" Ryzen 5 PRO 7530U 32GB RAM Garancia 2028.02.27.
- Lenovo T490S i5 8365U, 16GB RAM, 256GB SSD, jó akku, számla, 6 hó gar
- GAMING PC! Ryzen 5700X / RTX 3070 / 32GB 3600MHz / SSD / 700w Gold!
- 27% - LG UltraGear 27GS75Q-B Monitor! 2560x1440 / 200Hz / 1ms / G-Sync / G-Sync / FreeSync
- ÁRGARANCIA!Épített KomPhone i7 14700KF 32/64GB RAM RTX 5070 12GB GAMER PC termékbeszámítással
- Apple iPhone 17 Pro Max 256GB Deep Blue Karcmentes állapot 100% akku (93 ciklus)
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest


