47 #include "esos_pc_stdio.h"
50 #include <sys/select.h>
66 #define CONFIG_LED1() CONFIG_RB15_AS_DIG_OUTPUT()
68 #define CONFIG_SLAVE_ENABLE() CONFIG_RB3_AS_DIG_OUTPUT()
69 #define SLAVE_ENABLE() _LATB3 = 1 //high true assertion
70 #define SLAVE_DISABLE() _LATB3 = 0
72 #define CONFIG_LED1() printf("called CONFIG_LED1()\n")
73 #define CONFIG_SLAVE_ENABLE() printf("called CONFIG_SLAVE_ENABLE()\n")
74 #define SLAVE_ENABLE() printf("called SLAVE_ENABLE()\n")
75 #define SLAVE_DISABLE() printf("called SLAVE_DISABLE()\n")
80 void configSPI1(
void);
84 char psz_CRNL[3]= {0x0D, 0x0A, 0};
85 char psz_prompt[] =
"Temp is ";
86 char psz_done[9]= {
' ',
'D',
'O',
'N',
'E',
'!',0x0D, 0x0A, 0};
105 __esos_tmrSvcsExecute();
199 u16_hi = au16_data[2];
200 u16_lo = au16_data[1];
202 i16_temp = ((u16_hi<<8) | u16_lo);
218 float f_tempC, f_tempF;
223 f_tempC = (float) i16_temp;
224 f_tempC = f_tempC/256;
225 f_tempF = f_tempC*9/5 + 32;
226 printf(
"Temp is: 0x%0X, %4.4f (C), %4.4f (F)\n", i16_temp, (
double) f_tempC, (
double) f_tempF);
232 void configSPI1(
void) {
234 SPI1CON1 = SEC_PRESCAL_1_1 |
236 CLK_POL_ACTIVE_HIGH |
244 CONFIG_SLAVE_ENABLE();
246 SPI1STATbits.SPIEN = 1;
262 __esos_unsafe_PutString( HELLO_MSG );