Ú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ál
Kü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!
- Microsoft Surface Prémium minőségi Érintős Laptop Ultrabook 13,5"-65% i7-1185G7 16/512 Tűéles Retina
- Samsung Galaxy Z Fold7 Dual SIM 256GB 12GB RAM 5G (Jet Black) Fekete, gyári független. BONTATLAN!
- LEGJOBB ÁR AKCIÓ! Samsung Galaxy Z Fold7 256GB 12GB RAM, gyári független. 2 hetes, hibátlan!
- Flint 3 Wi-Fi 7 Home Router
- ASUS ROG Strix G17 gaming laptop i7 / RTX 2060 / 16GB RAM / 512GB SSD 17,3" 144Hz
- Telefon felvásárlás!! Honor 200 Lite, Honor 200, Honor 200 Pro, Honor 200 Smart
- BESZÁMÍTÁS! ASRock B550M R5 5600X 32GB DDR4 512GB SSD MSI SuprimX RTX 3070Ti 8GB Zalman Z1 PLUS 750W
- 0perces! Samsung Galaxy Book5 Pro 360 2in1 Core Ultra 7 256V 16GB 2TB 16" WQXGA+ AMOLED TOUCH 1évgar
- PlayStation 5 SLIM DIGITAL 1 TB + kontroller 2026.12.09-ig garanciális, számlával!
- LG 39GX90SA-W - 39" Ívelt Smart OLED/ WQHD 2K / 240Hz & 0.03ms / 1300 Nits / G-Sync & FreeSync
Állásajánlatok
Cég: BroadBit Hungary Kft.
Város: Budakeszi
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest



