Index: branch/fall/sp4b2/SP4b2
===================================================================
--- branch/fall/sp4b2/SP4b2	(nonexistent)
+++ branch/fall/sp4b2/SP4b2	(revision 721)
@@ -0,0 +1,198 @@
+/***********************************************************************/
+/*                                                                     */
+/*  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.                                    */
+/***********************************************************************/
+#include "sfr32c87.h"
+#define LCD_PORT p3
+#define LCD_PORT_DIR 1
+#define LCD_E LCD_PORT_2
+#define LCD_RW LCD_PORT_1
+#define LCD_DC LCD_PORT_0                
+#define LCD_E_DIR LCD_PORT_DIR                                                        
+#define LCD_RW_DIR LCD_PORT_DIR                        
+#define LCD_DC_DIR LCD_PORT_DIR
+
+
+
+void lcd_4b (unsigned char car);
+void lcd_8b (unsigned char car);
+void lcd_com (unsigned char car);
+void lcd_init (void);
+void lcd_car (unsigned char c);
+void tpo_ms(int t);
+void tpo_us(int t);
+char test;
+char touche;
+
+void main(void)
+{
+ /*pd1=0xFF; // déclare la broche p1 en sortie 	
+ lcd_4b(0xFF); // variable de test mise à 1111 1111
+ lcd_8b(0xFF); // appel de la fonction lcd_8b en lui passant la variable de test  1111 1111 */
+	
+ char c;
+ lcd_init ();
+ pd10= 0x0F;
+ pu31=1;
+ p10=0x00;
+ 
+ 	while (1){
+   		test=p10;
+  		p10= 0xFe;
+   		test=p10;
+		
+   		if (test==0xDe){
+   			touche ='2';
+        }
+     
+     	if (test==0xbe){
+   			touche ='1';
+         }
+   		if (test==0x7e){
+   			touche ='3';
+         }
+    
+   
+   
+   		p10= 0xFd;
+   		test=p10;
+   		if (test==0xdd){
+  			touche ='5';
+         }
+     	if (test==0xbd){
+   			touche ='4';
+         }
+   		if (test==0x7d){
+   			touche ='6';
+         }
+     
+	 
+  		p10= 0xFb;
+   		test=p10;
+  		if (test==0xdb){
+   			touche ='8';
+         }
+     	if (test==0xeb){
+   			touche ='7';
+         }
+   		if (test==0x7b){
+   			touche ='9';
+         }
+     
+	 
+   		p10= 0xF7;
+   		test=p10;
+   		if (test==0xd7){
+   			touche ='0';
+         }
+      	if (test==0x77){
+   			touche ='#';
+         }
+    	if (test==0xe7){
+   			touche ='*';
+         }
+	lcd_car (touche);
+	}
+	
+}
+
+
+void lcd_4b(unsigned char car){	
+	
+	
+	p3_2=1; //commande du signal E (active la lecture et l'écriture)
+	
+	if (car & 0x80) // compare 1111111 & 1000 0000 renvois 1  donc on rentre dans le if 
+		p3_7=1;
+	else {
+		p3_7=0;
+	}	
+	if (car & 0x40 ) // compare 1111111 & 0100 0000 renvois 1  donc on rentre dans le if 
+		p3_6=1;
+	else {
+		p3_6=0;
+	}
+	if (car & 0x20)
+		p3_5=1;
+	else {
+		p3_5=0;
+	}
+	if (car & 0x10 )
+		p3_4=1;
+	else {
+		p3_4=0;
+	}
+	p3_2=0;
+}
+
+void lcd_8b(unsigned char car){	
+	lcd_4b(car); // test pour affichage des bits de pois forts 
+	lcd_4b(car << 4); // test pour affichage des bits de pois faibles 
+}
+
+void lcd_com(unsigned char car){	
+	p3_0=0;
+	lcd_8b(car);
+}
+
+
+void tpo_ms(int t)
+{
+        tcspr = 0x8a;
+        ta0mr = 0x82;
+        ta0=t*1000;
+        ta0s = 1;
+        ta0os=1;
+        ta0ic=0x00;
+        while (ir_ta0ic!=1);
+        ta0s=0;                
+}
+
+
+void tpo_us(int t)
+{
+        tcspr = 0x8a;
+        ta0mr = 0x82;
+        ta0=t;
+        ta0s = 1;
+        ta0os=1;
+        ta0ic=0x00;
+        while (ir_ta0ic!=1);
+        ta0s=0;                
+}
+
+
+
+
+void lcd_init (void)
+{
+                
+    pd3=0xFF;
+    p3 = 0;
+    p3_0=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)
+{
+        p3_0=1;
+        lcd_8b(car);        
+}
\ No newline at end of file
