commit 2c0e04a7d9ad61a2159c571e0427d5a1b031dcfb Author: Yohan Boujon Date: Sat Mar 20 19:25:09 2021 +0100 Additions from 18/05/2021 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..40a3834 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vs/** +**/Debug diff --git a/README.md b/README.md new file mode 100644 index 0000000..baebd94 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +Lancez le fichier 'transcoder\transcodeur.atsln' + +Tout d'abord connectez le STK500 au port COM3. + +Ensuite branchez le port de sortie au COM1. +Ouvez PuTTY et mettez les paramètres suivants : +Session + -Serial Port + -COM1 +Connection\SSH\Serial + -Port de connection COM1 + -9600 Bauds + -8 Bit de Data + -1 Bit de Stop + -Pas de parité + -Pas de flow control +Terminal + -Echo Always ON + +Ensuite branchez le RXD et le TXD au Port PD0 et PD1 respectivement. + +Branchez le PORTA et le PORTC au LCD (normalement les fils sont tous droits s'ils sont bien mis). + +Branchez PD2, PD3 et PB2 au SW0, SW1 et SW2 respectivement. +Vous aurez donc normalement : + -L'arrêt sur SW0 + -Les 4 vitesses sur SW1 + -Les 3 fréquences sur SW2 + +Enfin, branchez PB3 soit à un oscilloscope soit à un haut-parleur pour entendre/visualiser le transcodeur morse. +Vous n'avez plus qu'à programmer sur le STK500 le programme, et à mettre le texte que vous voulez sur PuTTY. \ No newline at end of file diff --git a/transcodeur.atsln b/transcodeur.atsln new file mode 100644 index 0000000..d7581e4 --- /dev/null +++ b/transcodeur.atsln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Atmel Studio Solution File, Format Version 11.00 +VisualStudioVersion = 14.0.23107.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{54F91283-7BC4-4236-8FF9-10F437C3AD48}") = "transcodeur", "transcodeur\transcodeur.cproj", "{DCE6C7E3-EE26-4D79-826B-08594B9AD897}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|AVR = Debug|AVR + Release|AVR = Release|AVR + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.ActiveCfg = Debug|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Debug|AVR.Build.0 = Debug|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.ActiveCfg = Release|AVR + {DCE6C7E3-EE26-4D79-826B-08594B9AD897}.Release|AVR.Build.0 = Release|AVR + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/transcodeur/lcd.c b/transcodeur/lcd.c new file mode 100644 index 0000000..00876f7 --- /dev/null +++ b/transcodeur/lcd.c @@ -0,0 +1,52 @@ +/* + * lcd.c + * + * Created: 17/05/2021 12:10:24 + * Author: yboujon1 + */ + +#include "main.h" +#include "lcd.h" + +void LCD_Init (void) +{ + DDRC = 0xFF; // Le port de controle en sortie + DDRA = 0xFF; // le port des donnees en sortie + PORTC &= ~(1< +#include +#include +#include +#include +#include +#include +#include \ No newline at end of file diff --git a/transcodeur/morse.c b/transcodeur/morse.c new file mode 100644 index 0000000..be1c7e8 --- /dev/null +++ b/transcodeur/morse.c @@ -0,0 +1,177 @@ +/* + * morse.c + * + * Created: 18/05/2021 15:47:14 + * Author: yboujon1 + */ + +#include "main.h" +#include "morse.h" + +unsigned char morse_library[LETTRES][7]= { {'a',POINT,TRAIT,'\0'}, +{'b',TRAIT,POINT,POINT,POINT,'\0'}, +{'c',TRAIT,POINT,TRAIT,POINT,'\0'}, +{'d',TRAIT,POINT,POINT,'\0'}, +{'e',POINT,'\0'}, +{'f',POINT,POINT,TRAIT,POINT,'\0'}, +{'g',TRAIT,TRAIT,POINT,'\0'}, +{'h',POINT,POINT,POINT,POINT,'\0'}, +{'i',POINT,POINT,'\0'}, +{'j',POINT,TRAIT,TRAIT,TRAIT,'\0'}, +{'k',TRAIT,POINT,TRAIT,'\0'}, +{'l',POINT,TRAIT,POINT,POINT,'\0'}, +{'m',TRAIT,TRAIT,'\0'}, +{'n',TRAIT,POINT,'\0'}, +{'o',TRAIT,TRAIT,TRAIT,'\0'}, +{'p',POINT,TRAIT,TRAIT,POINT,'\0'}, +{'q',TRAIT,TRAIT,POINT,TRAIT,'\0'}, +{'r',POINT,TRAIT,POINT,'\0'}, +{'s',POINT,POINT,POINT,'\0'}, +{'t',TRAIT,'\0'}, +{'u',POINT,POINT,TRAIT,'\0'}, +{'v',POINT,POINT,POINT,TRAIT,'\0'}, +{'w',POINT,TRAIT,TRAIT,'\0'}, +{'x',TRAIT,POINT,POINT,TRAIT,'\0'}, +{'y',TRAIT,POINT,TRAIT,TRAIT,'\0'}, +{'z',TRAIT,TRAIT,POINT,POINT,'\0'}, +{'0',TRAIT,TRAIT,TRAIT,TRAIT,TRAIT,'\0'}, +{'1',POINT,TRAIT,TRAIT,TRAIT,TRAIT,'\0'}, +{'2',POINT,POINT,TRAIT,TRAIT,TRAIT,'\0'}, +{'3',POINT,POINT,POINT,TRAIT,TRAIT,'\0'}, +{'4',POINT,POINT,POINT,POINT,TRAIT,'\0'}, +{'5',POINT,POINT,POINT,POINT,POINT,'\0'}, +{'6',TRAIT,POINT,POINT,POINT,POINT,'\0'}, +{'7',TRAIT,TRAIT,POINT,POINT,POINT,'\0'}, +{'8',TRAIT,TRAIT,TRAIT,POINT,POINT,'\0'}, +{'9',TRAIT,TRAIT,TRAIT,TRAIT,POINT,'\0'} +}; + +void envoyer_signe_morse(unsigned char signe_morse) +{ + switch(signe_morse){ + case POINT: + start_timer0(); + start_timer1(ONEMS); + wait_ocf1a_timer1(); + stop_timer0(); + wait_ocf1a_timer1(); + break; + case TRAIT: + start_timer0(); + start_timer1(3*ONEMS); + wait_ocf1a_timer1(); + stop_timer0(); + start_timer1(ONEMS); + wait_ocf1a_timer1(); + break; + case INTERLETTRE: + start_timer1(2*ONEMS); + wait_ocf1a_timer1(); + break; + case INTERMOT: + start_timer1(10*ONEMS); + wait_ocf1a_timer1(); + break; + case FIN: + resume_timer1(); + stop_timer1(); + break; + default: + break; + }; +} + +void maj2min_convert(char *tab, int n) +{ + int i; + for(i=0; i<=n; i++) + { + if(tab[i]>=65 && tab[i]<=90) //si c'est une majuscule + { + tab[i]=tab[i]+32; //la met en minuscule + } + else + { + tab[i]=tab[i]; //sinon rien + }; + }; +} + +void latin2morse(char *tab, int n) +{ + int i=0; //varie la chaine de caractere + int j=0; //varie la librarie + do + { + if(tab[i]==morse_library[j][0]) //verifie si le caractere correspond ? la librarie + { + library_checker(tab,&i,&j); //traduit dans la librairie et renvoie les deux variables pour continuer + } + else //si ce n'est pas dans la librarie + { + simple_terms(tab,&i,&j); //traduit directement les termes plus simples + }; + } + while(i + + + + + + Device + Startup + + + Atmel + 1.2.0 + C:/Program Files (x86)\Atmel\Studio\7.0\Packs + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include + + include + C + + + include + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\include\avr\iom16.h + + header + C + BDa+/Y5e630de26bwSjZpg== + + include/avr/iom16.h + + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\templates\main.c + template + source + C Exe + ke+693fxy85p6GOdRcSK5g== + + templates/main.c + Main file (.c) + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\templates\main.cpp + template + source + C Exe + YXFphlh0CtZJU+ebktABgQ== + + templates/main.cpp + Main file (.cpp) + + + + C:/Program Files (x86)\Atmel\Studio\7.0\Packs\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega16 + + libraryPrefix + GCC + + + gcc/dev/atmega16 + + + + + ATmega_DFP + C:/Program Files (x86)/Atmel/Studio/7.0/Packs/atmel/ATmega_DFP/1.2.132/Atmel.ATmega_DFP.pdsc + 1.2.132 + true + ATmega16 + + + + Resolved + Fixed + true + + + \ No newline at end of file diff --git a/transcodeur/transcodeur.cproj b/transcodeur/transcodeur.cproj new file mode 100644 index 0000000..edad823 --- /dev/null +++ b/transcodeur/transcodeur.cproj @@ -0,0 +1,182 @@ + + + + 2.0 + 7.0 + com.Atmel.AVRGCC8.C + dce6c7e3-ee26-4d79-826b-08594b9ad897 + ATmega16 + none + Executable + C + $(MSBuildProjectName) + .elf + $(MSBuildProjectDirectory)\$(Configuration) + transcodeur + transcodeur + transcodeur + Native + true + false + true + true + 0x20000000 + + true + exception_table + 2 + 0 + + + + + + + + + + + + + com.atmel.avrdbg.tool.stk500 + + 0x1E9403 + + + + 125000 + + ISP + + com.atmel.avrdbg.tool.stk500 + + + STK500 + + ISP + 125000 + + + + + + + + com.atmel.avrdbg.tool.simulator + + + Simulator + + + + + + -mmcu=atmega16 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega16" + True + True + True + True + False + True + True + + + NDEBUG + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include + + + Optimize for size (-Os) + True + True + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include + + + + + + + + + -mmcu=atmega16 -B "%24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\gcc\dev\atmega16" + True + True + True + True + False + True + True + + + DEBUG + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include + + + Optimize (-O1) + True + True + Default (-g2) + True + + + libm + + + + + %24(PackRepoDir)\atmel\ATmega_DFP\1.2.132\include + + + Default (-Wa,-g) + + + + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + compile + + + + \ No newline at end of file