S
smiler
Guest
Her er min begynnelsen koden, midlertidig stoppe her når Kompileringsfeil
Code:void main ()
(/ / TODO: BRUKER KODE!
/ / MNEMONICS for knapper
# define row1 PIN_A0
# define row2 PIN_A1
# define row3 PIN_A2
# define row4 PIN_A3
# define col1 PIN_D3
# define col2 PIN_D2
# define col3 PIN_D1
# define col4 PIN_D0
/ / MNEMONICS for LCD
# define lcd_rs PIN_B0
# define lcd_rw PIN_B1
# define lcd_e PIN_B2
# define lcd_cmd_wri 0x00
# define lcd_data_wri 0x01
# define lcd_set_function 0x30
# define lcd_set_visible 0x0E
# define lcd_set_mode 0x06
# define lcd_set_home_address 0x80
# define lcd_clear 0x01set_tris_a (0xFF);
set_tris_b (0x00);
set_tris_c (0x00);
set_tris_d (0x00);
output_high (PIN_C0);
//.........
/ / fortsetter .......
//.........
)
void WriteToLCD (char type, røye melding)
(
if (type == "data") (
output_d (message);
output_b (lcd_data_wri);
)
if (type == "command") (
output_d (message);
output_b (lcd_cmd_wri);
)
output_high (lcd_e);
# ASM
nop
# endasm
output_low (lcd_e);
)
void InitLCD ()
(
WriteToLCD ( "kommando", lcd_set_function); / / det står feil: forsøk på å skape en peker til konstant under de ligner
WriteToLCD ( "kommando", lcd_set_visible);
WriteToLCD ( "kommando", lcd_set_mode);
WriteToLCD ( "kommando", lcd_set_home_address);
)
void ClearLCD ()
(
WriteToLCD ( "kommando", lcd_clear);
WriteToLCD ( "kommando", lcd_set_home_address);
)
Code:void main ()
(/ / TODO: BRUKER KODE!
/ / MNEMONICS for knapper
# define row1 PIN_A0
# define row2 PIN_A1
# define row3 PIN_A2
# define row4 PIN_A3
# define col1 PIN_D3
# define col2 PIN_D2
# define col3 PIN_D1
# define col4 PIN_D0
/ / MNEMONICS for LCD
# define lcd_rs PIN_B0
# define lcd_rw PIN_B1
# define lcd_e PIN_B2
# define lcd_cmd_wri 0x00
# define lcd_data_wri 0x01
# define lcd_set_function 0x30
# define lcd_set_visible 0x0E
# define lcd_set_mode 0x06
# define lcd_set_home_address 0x80
# define lcd_clear 0x01set_tris_a (0xFF);
set_tris_b (0x00);
set_tris_c (0x00);
set_tris_d (0x00);
output_high (PIN_C0);
//.........
/ / fortsetter .......
//.........
)
void WriteToLCD (char type, røye melding)
(
if (type == "data") (
output_d (message);
output_b (lcd_data_wri);
)
if (type == "command") (
output_d (message);
output_b (lcd_cmd_wri);
)
output_high (lcd_e);
# ASM
nop
# endasm
output_low (lcd_e);
)
void InitLCD ()
(
WriteToLCD ( "kommando", lcd_set_function); / / det står feil: forsøk på å skape en peker til konstant under de ligner
WriteToLCD ( "kommando", lcd_set_visible);
WriteToLCD ( "kommando", lcd_set_mode);
WriteToLCD ( "kommando", lcd_set_home_address);
)
void ClearLCD ()
(
WriteToLCD ( "kommando", lcd_clear);
WriteToLCD ( "kommando", lcd_set_home_address);
)