Projet

Général

Profil

601 rademagalh
/***********************************************************************/
/* */
/* FILE :sp4b2.c */
/* DATE :Fri, May 28, 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. */
/***********************************************************************/

626 rademagalh
#include "sfr32c87.h"


void LCD4b(unsigned char c){
/// Fonction de configuration LCD sur 4bits
p3_2=1; // E = 1
if (c&0x80) p3_7=1;
else p3_7=0;

if (c&0x40) p3_6=1;
else p3_6=0;

if (c&0x20) p3_5=1;
else p3_5=0;

if (c&0x10) p3_4=1;
else p3_4=0;
p3_2=0; // E = 0
}

void LCD8b(unsigned char c){
unsigned char pdsfa;
LCD4b(c);
pdsfa=c<<4;
LCD4b(pdsfa);
}

void LCDCom(unsigned char c){
p3_0=0;
LCD8b(c);
}

void LCDChar(unsigned char c){
p3_0=1;
LCD8b(c);
}

654 rademagalh
void LCDStr(unsigned char *str){
int i=0;
do{
LCDChar(str[i]);
//tpo_ms(1);
i++;
}
while(str[i]!='\0')
}
626 rademagalh
void lcd_init(){
p3_0=0;
//tpo_ms(15);
LCD4b(0x30);
//tpo_ms(5);
LCD4b(0x30);
//tpo_us(100);
LCD4b(0x30);
//tpo_us(100);
LCD4b(0x20);
LCDCom(0x28);
LCDCom(0x06);
LCDCom(0x0E);
LCDCom(0x01);
//tpo_ms(5);
}

601 rademagalh
void main(void)
{
626 rademagalh
pd3=0xff;
lcd_init();
LCDChar('a');

601 rademagalh
}