Projet

Général

Profil

328 thcoulaud
/***********************************************************************/
/* */
/* FILE :SP4b1.c */
/* DATE :Tue, May 18, 2021 */
/* DESCRIPTION :main program file. */
/* CPU GROUP :87B */
/* */
/* This file is generated by Renesas Project Generator (Ver.4.18). */
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
/***********************************************************************/
444 thcoulaud
#include "sfr32c87.h"
#define LCD_DC p3_0
328 thcoulaud
442 thcoulaud
void lcd_4b(unsigned char c){
pd1==0xff;
337 thcoulaud
442 thcoulaud
if (c & 0b10000000)
{
p1_7=1;
337 thcoulaud
}
442 thcoulaud
else
{
p1_7=0;
}
444 thcoulaud
if (c & 0b10000000)
442 thcoulaud
{
p1_6=1;
}
else{
p1_6=0;
}
444 thcoulaud
if (c & 0b10000000)
442 thcoulaud
{
p1_5=1;
}
else{
p1_5=0;
}
444 thcoulaud
if (c & 0b10000000)
442 thcoulaud
{
p1_4=1;
}
else{
p1_4=0;
}
444 thcoulaud
if (c & 0b10000000){
p1_2=1;
}
else{
p1_2=0;
}
442 thcoulaud
328 thcoulaud
}
442 thcoulaud
void lcd_8b(unsigned char car){
lcd_4b(car <<4);
337 thcoulaud
442 thcoulaud
}

void lcd_com(unsigned char com){
p1_0=0;
lcd_8b(com);
}

void lcd_init(void)
{
LCD_DC=0 ;
//tpo_ms(15);
lcd_4b(0x30);
//tpo_ms(5);
lcd_4b(0x30);
//tpo_us(100);
lcd_4b(0x30);
//tpo_us(100);
lcd_4b(0x20);
lcd_com(0x28);
lcd_com(0x06);
lcd_com(0x0E);
lcd_com(0x01);
//tpo_ms(5);
}

void lcd_car(unsigned char car){
p1_0=1;
lcd_8b(car);
}

void lcd_str(unsigned char *str){
unsigned char i=0;
while(str[i]){
lcd_car(str[i++]);
}
}


void main(void){
lcd_4b(0xf0);
lcd_4b(0xA0);
}

337 thcoulaud