M
Maverickmax
Guest
Hej
Jeg er ikke sikker på, at jeg har skrevet kode i korrekte måder, fordi jeg er lidt forvirret med E1 og E2.Jeg tror, de er vant til at overføre give signal til master og slave hhv.Bascially jeg vil udskrive en linje på toppen og venstre hjørne af LCD.Ret mig hvis jeg har lavet en fejl i min kode
På forhånd tak
MM
PS Hvis du hjælpe mig med at løse dette spørgsmål, vil jeg belønne dig kæmpestor 150 point
Code:/ / Funktion Prototyper
void Display (int status);
void Display_Start_Line (int Row);
void Static_Drive (int Drive);
void Column_Address (int Adresse);
void Page (int Number);
void DutyCycle (int Switch);
void ADC_Select (int Output);
void End ();void Write_Display (int Line);void Delay ();void Delay ()
(
int i;for (i = 0; i <100; i );
)void Display (int Status)
(
statisk int DATA;DATA = 0x5E | Status;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00void Display_Start_Line (int Row)
(
statisk int DATA;DATA = 0xCE | Row;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00
void Static_Drive (int Drive)
(
statisk int DATA;DATA = 0xAE | Drive;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void Column_Address (int Adresse)
(
statisk int DATA;DATA = Adresse;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void Page (int Number)
(
statisk int DATA;DATA = 0xB8 | Antal;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void DutyCycle (int Switch)
(
statisk int DATA;DATA = 0xA8 | Switch;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void ADC_Select (int Output)
(
statisk int DATA;DATA = 0xa0 | Output;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void End ()
(
PORTB = 0xEE;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void Write_Display (int Line)
(
statisk int DATA;DATA = Line;
PORTB = DATA;
PORTE = 0x01; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x05;
Delay ();
PORTE = 0x00;
PORTB = 0x00int vigtigste (void)
(/ / usignerede CHAR counter;DDRB = 0xFF;
DDRE = 0xFF;PORTB = 0x00;
PORTE = 0x00;Display (0x01);
Display_Start_Line (0x00);
Static_Drive (0x00);
Column_Address (0x00);
Page (0x03);
DutyCycle (0x01);
ADC_Select (0x00);
End ();Write_Display (0xFF);
mens (1)
(tilbagevenden 1;
))
Jeg er ikke sikker på, at jeg har skrevet kode i korrekte måder, fordi jeg er lidt forvirret med E1 og E2.Jeg tror, de er vant til at overføre give signal til master og slave hhv.Bascially jeg vil udskrive en linje på toppen og venstre hjørne af LCD.Ret mig hvis jeg har lavet en fejl i min kode
På forhånd tak
MM
PS Hvis du hjælpe mig med at løse dette spørgsmål, vil jeg belønne dig kæmpestor 150 point
Code:/ / Funktion Prototyper
void Display (int status);
void Display_Start_Line (int Row);
void Static_Drive (int Drive);
void Column_Address (int Adresse);
void Page (int Number);
void DutyCycle (int Switch);
void ADC_Select (int Output);
void End ();void Write_Display (int Line);void Delay ();void Delay ()
(
int i;for (i = 0; i <100; i );
)void Display (int Status)
(
statisk int DATA;DATA = 0x5E | Status;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00void Display_Start_Line (int Row)
(
statisk int DATA;DATA = 0xCE | Row;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00
void Static_Drive (int Drive)
(
statisk int DATA;DATA = 0xAE | Drive;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void Column_Address (int Adresse)
(
statisk int DATA;DATA = Adresse;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void Page (int Number)
(
statisk int DATA;DATA = 0xB8 | Antal;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void DutyCycle (int Switch)
(
statisk int DATA;DATA = 0xA8 | Switch;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void ADC_Select (int Output)
(
statisk int DATA;DATA = 0xa0 | Output;
PORTB = DATA;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void End ()
(
PORTB = 0xEE;
PORTE = 0x00; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x04;
Delay ();
PORTE = 0x00;
PORTB = 0x00;
)void Write_Display (int Line)
(
statisk int DATA;DATA = Line;
PORTB = DATA;
PORTE = 0x01; / / A0 - 0 Bit
/ / R / W - 1 Bit
/ / E2 - 2 Bit (Slave)
/ / E1 - 3 Bit (Master)
PORTE = 0x05;
Delay ();
PORTE = 0x00;
PORTB = 0x00int vigtigste (void)
(/ / usignerede CHAR counter;DDRB = 0xFF;
DDRE = 0xFF;PORTB = 0x00;
PORTE = 0x00;Display (0x01);
Display_Start_Line (0x00);
Static_Drive (0x00);
Column_Address (0x00);
Page (0x03);
DutyCycle (0x01);
ADC_Select (0x00);
End ();Write_Display (0xFF);
mens (1)
(tilbagevenden 1;
))