Practica 1 JM60 Bootloader
Escrito por braulio elias chi salavarria
PRÁCTICA #1
Para encender y apagar un led, primero tenemos que configurar el pin como salida en el registro PTXDD


Para habilitar los pullup en la entrada, es necesario configurar el registro PTXPE
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
|
/** ################################################################### ** Filename : uno.C ** Project : uno ** Processor : MC9S08JM60CLHE ** Version : Driver 01.11 ** Compiler : CodeWarrior HCS08 C Compiler ** Date/Time : 03/04/2010, 12:54 a.m. ** Abstract : ** Main module. ** This module contains user's application code. ** Settings : ** Contents : ** No public methods ** ** ###################################################################*/ /* MODULE uno */ /* Including needed modules to compile this module/procedure */ #include "Cpu.h" #include "Events.h" /* Include shared modules, which are used for whole project */ #include "PE_Types.h" #include "PE_Error.h" #include "PE_Const.h" #include "IO_Map.h" /* User includes (#include below this line is not maintained by Processor Expert) */ void delay(unsigned int delay_val){ for(;delay_val;delay_val--); } void main(void) { /* Write your local variable definition here */ /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/ PE_low_level_init(); /*** End of Processor Expert internal initialization. ***/ /* Write your code here */ /* For example: for(;;) { } */ PTDDD_PTDDD3=1; //configuramos el pin ptd3 como salida PTGDD_PTGDD2=0; //configuramos el pin ptg2 como entrada PTGPE_PTGPE2=1; //habilitamos pull up en ptg2 for(;;){ if(!PTGD_PTGD2){ PTDD_PTDD3=~PTDD_PTDD3; delay(10000); } } /*** Don't write any code pass this line, or it will be deleted during code generation. ***/ /*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/ for(;;){} /*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/ } /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***/ /* END uno */ /* ** ################################################################### ** ** This file was created by Processor Expert 3.07 [04.34] ** for the Freescale HCS08 series of microcontrollers. ** ** ################################################################### */
|
En el protoboard, veremos que no se ve el parpadeo del led, ya que esta funcionando a una velocidad de 24MHz, pero checandolo en el osciloscopio DSO NANO tenemos la siguiente gráfica y a una frecuencia de 54Hz

Adjunto el proyecto completo, para descargar, tendrás que estar registrado, abajo aparecerá el link de descarga.
Escribir un comentario