| Índice de artículos |
|---|
| Comunicacion Inalambrica QE8 y JM8 parte 2 |
| Receptor JM8 |
| Software C# |
| Todas las páginas |
Seguimos con la descripción del programa, en el archivo 1_wire.c se describen todas las funciones, debido a su tamaño, no lo pondré directamente, pero estará como archivo adjunto para poder descargarlo. Aquí una parte del programa, donde se describen las funciones para escribir y leer un bit.
1 |
/***************************************************************************** |
El programa en main funciona de la siguiente manera, cuando se genera una interrupción en RTC cada dos segundos, el microcontrolador sale del estado STOP, o dormido, para leer el sensor y mandarlo por el puerto SCI al modulo RF.
1 |
void interrupt VectorNumber_Vrtc rtc_isr(void){ |
Y dentro del ciclo for(;;) tenemos:
1 |
for(;;) { |
En el diagrama se describe mejor como esta el programa:
Un inconveniente que tuve, fue que el QE8 solo tiene 512bytes en RAM, por lo tanto, como la libreria del sensor DS18S20 ocupa bastante memoria, tuve que borra el sector de la RAM ZERO para hacer un direccionamiento directo, asi quedo el archivo project.prm
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 |
/* This is a linker parameter file for the mc9s08qe8 */ NAMES END /* CodeWarrior will pass all the needed files to the linker by command line. But here you may add your own files too. */ SEGMENTS /* Here all RAM/ROM areas of the device are listed. Used in PLACEMENT below. */ RAM = READ_WRITE 0x060 TO 0x025F; ROM = READ_ONLY 0xE000 TO 0xFFAD; ROM1 = READ_ONLY 0xFFC0 TO 0xFFCD; /* INTVECTS = READ_ONLY 0xFFCE TO 0xFFFF; Reserved for Interrupt Vectors */ END PLACEMENT /* Here all predefined and user segments are placed into the SEGMENTS defined above. */ DEFAULT_RAM, /* non-zero page variables */ INTO RAM; _PRESTART, /* startup code */ STARTUP, /* startup data structures */ ROM_VAR, /* constant variables */ STRINGS, /* string literals */ VIRTUAL_TABLE_SEGMENT, /* C++ virtual table segment */ DEFAULT_ROM, COPY /* copy down information: how to initialize variables */ INTO ROM; /* ,ROM1: To use "ROM1" as well, pass the option -OnB=b to the compiler */ END STACKSIZE 0x50 VECTOR 0 _Startup /* Reset vector: this is the default entry point for an application. */ |
















