Changeset 17628 for firmware/FSC/src
- Timestamp:
- 03/18/14 16:21:24 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
firmware/FSC/src/muxer_fsc.c
r10910 r17628 1 1 #include "muxer_fsc.h" 2 #include "usart.h"3 2 // Sets voltage Muxer to current channel 4 3 // this is a Muxing, and therefor the adc might need some time to settle. … … 11 10 // channel 40..79 --> looking at the current channels 12 11 // channel 80..83 --> looking at the humidities 13 void Set_V_Muxer (U08 channel) {14 U08 SB = 0;15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 12 void Set_V_Muxer (U08 channel) { 13 U08 SB = 0; 14 // voltages 15 if (channel < 40) { 16 if (channel < 36) 17 SB = channel*2; 18 else 19 SB = (channel+1)*2; 20 } 21 // currents 22 else if (channel < 80) { 23 channel -= 40; 24 if (channel < 36) 25 SB = channel*2+1; 26 else 27 SB = (channel+1)*2+1; 28 } 29 // humidities 30 else if (channel < 84) { 31 channel -= 80; 32 switch (channel) { 33 case 0: 34 SB = 0x48; //0100.1000 35 break; 36 case 1: 37 SB = 0x49; //0100.1001 38 break; 39 case 2: 40 SB = 0x52; //0101.0010 41 break; 42 case 3: 43 SB = 0x53; //0101.0011 44 break; 45 } // end of switch-case 46 } // end of if (channel < some_number) 48 47 49 48 PORTC = (PORTC & 0x80) | (0x7F & SB); // Here the muxer is switched. 50 49 } 51 50 52 51 void Set_T_Muxer(U08 channel) { 53 U08 SA = 0x00; 54 55 switch (channel/16) { 56 case 0: 57 SA |= 1<<4; // 0001.0000 58 break; 59 case 1: 60 break; // 0000.0000 61 case 2: 62 SA |= (1<<4)|(1<<5); // 0011.0000 63 break; 64 case 3: 65 SA |= 1<<5; // 0010.0000 66 break; 67 } 68 69 SA = SA | (channel%16); 70 71 PORTA = (PORTA & 0xC0) | (0x3F & SA); // Here the muxer is switched. 52 U08 SA = 0x00; 53 switch (channel/16) { 54 case 0: 55 SA |= 1<<4; // 0001.0000 56 break; 57 case 1: 58 break; // 0000.0000 59 case 2: 60 SA |= (1<<4)|(1<<5); // 0011.0000 61 break; 62 case 3: 63 SA |= 1<<5; // 0010.0000 64 break; 65 } 66 SA = SA | (channel%16); 67 PORTA = (PORTA & 0xC0) | (0x3F & SA); // Here the muxer is switched. 72 68 } 73 69
Note:
See TracChangeset
for help on using the changeset viewer.