Révision 509
Ajouté par jileng il y a presque 4 ans
SP4b2.c | ||
---|---|---|
/* This file is generated by Renesas Project Generator (Ver.4.18). */
|
||
/* NOTE:THIS IS A TYPICAL EXAMPLE. */
|
||
/***********************************************************************/
|
||
//importation bibliotheque
|
||
#include "sfr32c87.h"
|
||
|
||
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);
|
||
}
|
||
|
||
|
||
|
||
void main(void)
|
||
{
|
||
while(1){
|
||
pd3=0xff;
|
||
p3=0xff;
|
||
initPort1();
|
||
Lcd4b(0x00);
|
||
initPort1();
|
||
Lcd8b(0x00);
|
||
initPort1();
|
||
Lcd_init();
|
||
LcdChar(0x00);
|
||
|
||
|
||
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
Formats disponibles : Unified diff
Sp4b2 leng commit sp4b2.c et sessionm32c .hsf et.ini