root/branch/leng/sp4b2/SP4b2/SP4b2.c @ 509
492 | jileng | /***********************************************************************/
|
|
/* */
|
|||
/* FILE :SP4b2.c */
|
|||
/* DATE :Tue, May 25, 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. */
|
|||
/***********************************************************************/
|
|||
509 | jileng | //importation bibliotheque
|
|
#include "sfr32c87.h"
|
|||
492 | jileng | ||
509 | jileng | void initPort1(void)
|
|
{
|
|||
pd3=0xff;
|
|||
p3=0x00;
|
|||
}
|
|||
void decodeChar(char c){
|
|||
if(c & 0x10){
|
|||
p3_4=1;
|
|||
}
|
|||
else{
|
|||
p3_4=0;
|
|||
}
|
|||
if(c & 0x20){
|
|||
p3_5=1;
|
|||
}
|
|||
else{
|
|||
p3_5=0;}
|
|||
if(c & 0x80){
|
|||
p3_6=1;
|
|||
}
|
|||
else{
|
|||
p3_6=0;
|
|||
}
|
|||
if(c & 0xf0){
|
|||
p3_7=1;
|
|||
}
|
|||
else{
|
|||
p3_7=0;
|
|||
}
|
|||
}
|
|||
void decodeCharF(char c){
|
|||
if(c & 0x01){
|
|||
p3_1=1;
|
|||
}
|
|||
else{
|
|||
p3_1=0;
|
|||
}
|
|||
if(c & 0x02){
|
|||
p3_2=1;
|
|||
}
|
|||
else{
|
|||
p3_2=0;
|
|||
}
|
|||
if(c & 0x08){
|
|||
p3_3=1;
|
|||
}
|
|||
else{
|
|||
p3_3=0;
|
|||
}
|
|||
if(c & 0x0f){
|
|||
p3_4=1;
|
|||
}
|
|||
else{
|
|||
p3_4=0;
|
|||
}
|
|||
}
|
|||
void Lcd4b(char c){
|
|||
p3_2=1;
|
|||
decodeChar(c);
|
|||
p3_2=0;
|
|||
}
|
|||
void Lcd8b(char c){
|
|||
p3_2=1;
|
|||
decodeChar(c);
|
|||
decodeCharF(c);
|
|||
p3_2=0;
|
|||
}
|
|||
void LcdCom(char c){
|
|||
p3_0=0;
|
|||
Lcd8b(c);
|
|||
}
|
|||
void Lcd_init(void){
|
|||
Lcd4b();
|
|||
LcdCom();
|
|||
}
|
|||
void LcdChar(char c){
|
|||
p3_0=1;
|
|||
Lcd4b(c);
|
|||
}
|
|||
492 | jileng | void main(void)
|
|
{
|
|||
509 | jileng | while(1){
|
|
pd3=0xff;
|
|||
p3=0xff;
|
|||
initPort1();
|
|||
Lcd4b(0x00);
|
|||
initPort1();
|
|||
Lcd8b(0x00);
|
|||
initPort1();
|
|||
Lcd_init();
|
|||
LcdChar(0x00);
|
|||
492 | jileng | ||
509 | jileng | ||
}
|
|||
492 | jileng | }
|
|
509 | jileng |