Changeset 10677 for firmware/FSC/src/FSC_eth_with_user_interface.c
- Timestamp:
- 05/12/11 17:47:17 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FSC/src/FSC_eth_with_user_interface.c
r10674 r10677 33 33 34 34 // ATMEGA ADC global variables 35 U08 adc_values[VOLTAGE_CHANNELS]; // stores measured voltage in steps of 16mV 35 U08 adc_readings_until_mean=250; 36 U32 adc_values[VOLTAGE_CHANNELS]; // stores measured voltage in steps of 16mV 36 37 U08 adc_enables[VOLTAGE_CHANNELS/8]; 37 38 U08 adc_channels_ready[VOLTAGE_CHANNELS/8]; 38 39 U08 adc_readings_since_last_muxing = 0; 39 40 U08 adc_current_channel = 0; 40 U 08adc_current_reading = 0;41 U16 adc_current_reading = 0; 41 42 bool adc_measured_all = false; 42 43 bool adc_values_printed = true; … … 45 46 bool once_told_you = true; 46 47 bool debug_mode = false; 48 49 // ETHERNET VARS 50 U08 downloaded_bytes; 47 51 48 52 //----------------------------------------------------------------------------- 49 53 // M A I N --- M A I N --- M A I N --- M A I N --- M A I N 50 54 //----------------------------------------------------------------------------- 55 /* 51 56 int main(void) 52 57 { … … 58 63 received_bytes = get_S0_RX_RSR(); 59 64 60 usart_write_U16_hex(get_S0_TX_FSR()); usart_write_char('\t'); usart_write_char('|'); 61 usart_write_U16_hex(get_S0_TX_RD()); usart_write_char('\t'); usart_write_char('|'); 62 usart_write_U16_hex(get_S0_TX_WR()); usart_write_char('\t'); usart_write_char('|'); 63 usart_write_U16_hex(get_S0_RX_RSR()); usart_write_char('\t'); usart_write_char('|'); 64 usart_write_U16_hex(get_S0_RX_RD()); usart_write_char('\t'); usart_write_char('|'); 65 65 66 66 67 … … 115 116 116 117 } // end of main() 117 118 */ 118 119 int main(void) 119 120 { … … 141 142 static U08 welcome[]="welcome to:\n FSC command interface 0.1 \n build: ??.05.2010\n"; 142 143 usart_write_str(welcome); 144 /* 143 145 print_help(); 144 146 print_adc_enable_status(true); … … 149 151 usart_write_U32(sec , 7); 150 152 usart_write_str((pU08)" sec.\n"); 151 153 */ 152 154 //MAIN LOOP 153 155 while (1) 154 156 { 155 if (w5100_caretaker()) 157 // checks if socket is okay and resets in case of problem the W5100 158 if (w5100_caretaker()) 156 159 { 157 160 // something is not okay with the ethernet ... … … 159 162 } 160 163 164 // this if should check every 25ms if we have any data on the W5100 161 165 if ( (milisec % W5100_INPUT_CHECK_TIME == 0) && (w5100_ready) ) 162 166 { 163 167 if (get_S0_RX_RSR() != 0) { // we have something to read 164 really_downloaded_bytes = w5100_get_RX(ETH_READ_BUFFER_SIZE, true); 168 downloaded_bytes = w5100_get_RX(ETH_READ_BUFFER_SIZE, true); 169 usart_write_str((pU08)"got ethernet stream - no. of. bytes:"); 170 usart_write_U08(downloaded_bytes,3); 171 usart_write_char('\n'); 172 for (U08 i=0; i<downloaded_bytes; i++){ 173 usart_write_U08_hex(eth_read_buffer[i]); 174 usart_write_char(' '); 175 } 176 usart_write_char('\n'); 165 177 } 166 178 } … … 170 182 if(adc_print_endless){ 171 183 usart_write_str((pU08)"V|"); 172 usart_write_ float((float)local_ms/1000 , 1,4);184 usart_write_U32(sec ,8); 173 185 print_adc_nicely(false,true); 174 for ( U08 i=0; i< V_BITMAP; ++i ) {186 for ( U08 i=0; i<(VOLTAGE_CHANNELS/8); ++i ) { 175 187 adc_channels_ready[i]=0; 176 188 } … … 185 197 if(ad7719_print_endless){ 186 198 usart_write_str((pU08)"R|"); 187 usart_write_ float((float)local_ms/1000 , 1,4);199 usart_write_U32(sec ,8); 188 200 print_ad7719_nicely(false,true); 189 for ( U08 i=0; i< CHANNEL_BITMAP; ++i ) {201 for ( U08 i=0; i<(RESISTANCE_CHANNELS/8); ++i ) { 190 202 ad7719_channels_ready[i]=0; 191 203 } … … 224 236 if ( UCSRA & (1<<DOR) ){ 225 237 usart_write_str((pU08)"PC sending to fast!\n"); 226 usart_last_char = UDR; 238 //usart_last_char = UDR; 239 UDR; 227 240 // flush TX_buffer and write warning message in 228 241 // maybe even switch off every measurement. ?
Note:
See TracChangeset
for help on using the changeset viewer.