/* * Dump out the memory contents at address 'addr' * This is 'classic' hex dump format * * Note that the 'base' parameter allows you to * have the addresses be shown relative to the * the address passed. This lets the SD card code * display them as 0x000 - 0x1ff rather than the * address of the buffer they are held in. */ uint8_t * dump_line(int c, uint8_t *addr, uint8_t *base) { uint8_t *line_addr; uint8_t b; uint32_t tmp; int i; line_addr = addr; text_color(c, YELLOW); tmp = (uint32_t)line_addr - (uint32_t) base; uart_putnum(c, FMT_LONG, tmp); uart_puts(c, " | "); text_color(c, GREEN); for (i = 0; i < 16; i++) { uart_putnum(c, FMT_BYTE, *(line_addr+i)); uart_putc(c, ' '); if (i == 7) { uart_puts(c, " "); } } text_color(c, WHITE); uart_puts(c, "| "); for (i = 0; i < 16; i++) { b = *line_addr++; uart_putc(c, ((b > 126) || (b < 32)) ? '.' : (char) b); } text_color(c, DEFAULT); uart_puts(c, "\n"); return line_addr; }
int main( void ) { int i; uart_init(9600); init_gpio(); init_PWM(); tss_init(); __enable_interrupts(); for( i=0; i<DELAY; i++) ; uart_putstr( "Initialization Complete\r\n" ); // wait for user to press a key uart_putstr( "Press any key:" ); uart_getchar(); TSI0_DATA |= TSI_DATA_SWTS_MASK; while( 1 ) { uart_putnum( tss_pin9, 5 ); // 2^16 = 65536 = 5 digits uart_putstr( "\t" ); uart_putnum( tss_pin10, 5 ); // 2^16 = 65536 = 5 digits uart_putstr( "\r\n" ); for( i=0; i<DELAY; i++); } return 0; }
/* * Send the escape sequence to position the cursor */ void move_cursor(int chan, int row, int col) { if ((row <= 0) || (col <= 0) || (row > 88) || (col > 200)) { return; } uart_puts(chan, CSI); uart_putnum(chan, FMT_BASE_10, row); uart_putc(chan, ';'); uart_putnum(chan, FMT_BASE_10, col); uart_putc(chan, 'H'); }
static void RadCalc_EVENT(void) { if (!Timer_1s) { // Every 1s (1Hz) Timer_1s = 1000; if ( _FLAG.LCDExist == _Set ) lcd_ctrl(_FLAG.LCDControl); static uint16_t table[Ilosc_pomiarow]; static uint8_t index; uint32_t sr1=0; ldiv_t result; table[index++] = pulse_counter; pulse_counter=0; if ( index >= Ilosc_pomiarow ) index=0; for (uint8_t i=0;i<Ilosc_pomiarow;i++) sr1 += table[i]; result = ldiv(sr1,100); sprintf(SecondLine, " %lu.%02lu uSv/h", result.quot, result.rem); uart_putnum(sr1,10); uart_putstr("\r\n"); } }