Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ---------- Main Function ------------------------------------------------- */
- int main( void )
- {
- IO_init( );
- ONEWIRE_init( );
- MODBUS_init( );
- // USART_init( );
- sei( ); // enable interrupts
- while ( 1 )
- {
- for ( uint8_t t_nb = 0; t_nb < THERMOMETERS; t_nb++ )
- {
- for ( uint16_t n = 0; n < 800; n++ )
- {
- delay_ms( 1 );
- switch ( n )
- {
- case 1: // convert temperature
- onewire_convert_t( t_nb );
- PORTD &= ~( 1 << LED );
- break;
- case 790: // read temperature
- PORTD |= ( 1 << LED );
- thermometer[ t_nb ].temperature = onewire_read_scratchpad( t_nb );
- break;
- default: // Modbus poll
- ( void )eMBPoll( );
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement