- RIOS Gépház: Alap vagy Profi? Két új üzleti előfizetés debütál a Hardveraprón!
- t72killer: Egy gyors töltőteszt
- Luck Dragon: Asszociációs játék. :)
- Lalikiraly: Astra kalandok @Harmadik rész
- D1Rect: Nagy "hülyétkapokazapróktól" topik
- btz: Internet fejlesztés országosan!
- Sub-ZeRo: Euro Truck Simulator 2 & American Truck Simulator 1 (esetleg 2 majd, ha lesz) :)
- Brogyi: CTEK akkumulátor töltő és másolatai
- sziku69: Szólánc.
- sziku69: Fűzzük össze a szavakat :)
Új hozzászólás Aktív témák
-
#90088192
törölt tag
válasz
buherton #6075 üzenetére
Koszonom
Remélem erre gondoltálKülönben igen érdekes maga a probléma, a bal oldali képernyő gyakorlatilag túlcsordul(Módosítottam a kodon így is duplázza az oszlopokat, es elkezd a 0. oszlopba írni)
Maga a problémás részlet:
void write_char(int line_select, int y_offset, int charcater_code)
{ int x;
if(y_offset>=(Display_width/2) && y_offset<=Display_width-Font_width) //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-Display_width/2); //Deducts the the half of the display size Set y
set_x(line_select); //Selects line of writing
for(x=(charcater_code-Font_offset)*Font_width; x<=((charcater_code-Font_offset)*Font_width)+Font_width; x++) //Decodes the character code and make sure the data is sent by 8 bits
{
send_data_screen(font6x8[x]); //Sends out the relevant section of the Array
}
} else if(y_offset<=(Display_width/2)-1 && 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-Font_offset)*Font_width; x<((charcater_code-Font_offset)*Font_width)+Font_width; x++) //Decodes the character code and make sure the data is sent by 8 bits
{if(y_offset+(x-(charcater_code-Font_offset)*Font_width)!=(Display_width/2)) //Checks if the character has reached the border of the 2 sides of the screen
{
send_data_screen(font6x8[x]);
}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); //Selects line of writing
send_data_screen(font6x8[x]); //Sends out the relevant section of the Array
}
}
}
else
{
MEMBRANE_MUTE=1;
}
}Es az egesz en block
#include "font6x8.h"
#include "screen.h"
#include "membrane.h"
#define Font_width 6
#define Font_offset 32
#define Font_height 8
#define Display_width 128
#define Dislpay_height 64
#define Display_rows 8
//#define Font_type font6x8
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<=Display_rows-1 && 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 send_data_screen (long int Data) //Sends Data to the Display hardware
{
DISPLAY_RS = 1; //Enables Data mode
DelayUs(5);
S_DATA_OUT = Data; //Insert Data to the hardware line
strobe_E();
}
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<=Display_rows-1;y++) //Loop for the rows
{
set_y(0); //Set y to 0
set_x(y); //Selects line of writing
for(x=0; x<(Display_width/2); x++) //Loop for the columns
{
send_data_screen(Fill);
}
}
}
void write_char(int line_select, int y_offset, int charcater_code)
{ int x;
if(y_offset>=(Display_width/2) && y_offset<=Display_width-Font_width) //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-Display_width/2); //Deducts the the half of the display size Set y
set_x(line_select); //Selects line of writing
for(x=(charcater_code-Font_offset)*Font_width; x<=((charcater_code-Font_offset)*Font_width)+Font_width; x++) //Decodes the character code and make sure the data is sent by 8 bits
{
send_data_screen(font6x8[x]); //Sends out the relevant section of the Array
}
} else if(y_offset<=(Display_width/2)-1 && 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-Font_offset)*Font_width; x<((charcater_code-Font_offset)*Font_width)+Font_width; x++) //Decodes the character code and make sure the data is sent by 8 bits
{if(y_offset+(x-(charcater_code-Font_offset)*Font_width)!=(Display_width/2)) //Checks if the character has reached the border of the 2 sides of the screen
{
send_data_screen(font6x8[x]);
}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); //Selects line of writing
send_data_screen(font6x8[x]); //Sends out the relevant section of the Array
}
}
}
else
{
MEMBRANE_MUTE=1;
}
}
void string_out(char* message, float variable, int line, int y_offset)
{
int Maximum_num_char= Display_width/Font_width; //Maximum number of characters what can be placed in one row
char test[Maximum_num_char],i=0,j;
char a[Maximum_num_char];
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*Font_width,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!
- Asus Rog Strix gamer laptop makulátlan állapotban.
- AZTA! Dell XPS 13 Plus 9320 13.4" Profi Notebook -70% Brutál i7-1260P 16/512 FHD+ Iris Xe /MILLIÓ/
- Asztali pc
- ASUS ROG STRIX Z790-H GAMING WIFI Alaplap - Garancia: 2027.01-15.-ig - BeszámítOK!
- Beszámítás! Apple iPhone 16 Pro MAX 256GB okostelefon garanciával hibátlan működéssel
- ÁRGARANCIA!Épített KomPhone Ryzen 5 4500 16/32/64GB RAM RTX 3050 6GB GAMER PC termékbeszámítással
- Telefon felvásárlás!! Apple Watch Series 9/Apple Watch Ultra/Apple Watch Ultra 2
- AKCIÓ! ASUS B460M i7 10700 16GB DDR4 512GB SSD GTX 1080Ti 11GB KOLINK Observatory TG TT 600W
- Telefon felvásárlás!! Samsung Galaxy S24/Samsung Galaxy S24+/Samsung Galaxy S24 Ultra
- Csere-Beszámítás! Olcsó RTX Gamer Laptop játékra! I5 11400H / RTX 3050Ti / 16GB DDR4 / 512GB SSD
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Promenade Publishing House Kft.
Város: Budapest