i am trying to write a code in C to transfer my signals from bluetooth to the compuer. I have four signals coming from a sensor unit. 2 AC and 2 DC. In my code I have already read those signals and sampled with AD converter , now when i am sending the data I do not know what should i define in the code. like how to assign values to bytes and pack the data, since im not a prgrammer :( this is my code, i would begrateful if you could give me some hints:
Expand|Select|Wrap|Line Numbers
- */
- //#include <macros.h>
- #include <iom32v.h>
- #include <mymacros.h>
- #include <AdcADS8341Layout.h>
- #include <AdcADS8341.h>
- #include <Delay.h>
- //#include <Uart.h>
- int main(void)
- {
- unsigned int PPG_IR_AC;
- unsigned int PPG_IR_DC;
- unsigned int PPG_R_AC;
- unsigned int PPG_R_DC;
- // Insert code
- do
- {
- // init the port
- // Ex
- DDRD = OUT7 | OUT6 | IN5 | IN4 | IN3 | IN2 | IN1 | IN0;
- SetBitMask(PORTD, BIT6);
- //Power On
- SetBit(PORTD,7);
- while(TRUE)
- {
- PPG_IR_AC = GetAdcADS8341(ADS8344_CH5);
- PPG_IR_DC = GetAdcADS8341(ADS8344_CH6);
- PPG_R_AC = GetAdcADS8341(ADS8344_CH7);
- PPG_R_DC = GetAdcADS8341(ADS8344_CH2);
- UartSendByteUB(PPG_IR_AC>>8); // How to send measured data to bluetooth transmitter
- UartSendByteUB(PPG_IR_AC); // How to send measured data to bluetooth transmitter
- UartSendByteUB(PPG_IR_DC>>8);
- UartSendByteUB(PPG_IR_DC);
- UartSendByteUB(PPG_R_AC>>8);
- UartSendByteUB(PPG_R_AC);
- UartSendByteUB(PPG_R_DC>>8);
- UartSendByteUB(PPG_R_DC);
- Delay(1024, 0.013); // delay
- }
- }while(0);
- return 0;
- }