• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » Low Power RF Proprietary Software & SimpliciTI Forum » simple_link.c
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

simple_link.c

This question is not answered
niketh
Posted by niketh
on Jun 01 2010 07:53 AM
Prodigy220 points

Hello

     I have modified simple_link.c for my project . Well my project demands 10 bit ADC output to be sent via radioMsg[] .since radioMsg is declared to be unsigned int8_t ,therefore the maximum value that can be sent over the air through the array is 2power8(256) . But 10 bit ADC ouput has values that goes beyond 256 . So is there any way that unsgned int16_t radioMsg[] could be achieved ...? i tried modifiying in header files wherever that variable exists , but there are just too many of them and this way of solving seems impossible .

 

Niketh M G

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • BrandonAzbell
    Posted by BrandonAzbell
    on Jun 01 2010 08:36 AM
    Guru55185 points

    You mentioned modifying simple_link.c.  What original software are you referencing, just so that it is clear what you are starting from.

    More directly to your inquiry, I wouldn't try to change the type of the message from int8_t to int16_t, but rather make the message multiple bytes long.  Your application code can determine the order of the bytes, ie. which byte holds the upper 2 bits of the 10-bit value.

    Brandon

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • niketh
    Posted by niketh
    on Jun 01 2010 13:54 PM
    Prodigy220 points

    Hey thanks for replying ..

    Let me be more specefic .I am compiling this modified simple_link.c using IAR workbench to be burnt into CC2510 based target board .I am inoutting 3 external analog inputs ,all to the ADC inputs . The results ,i have stored in adc_result[1],adc_result[2],adc_result[3] .If i choose a 10 bit resolution for ADC , i get the values for example 500,590,etc upto 1024 . The output of the ADCH and ADCL registers are put into an unsigned int16_t adc_result[].........Thus adc_result[] has the data ready in decimal format,and not the binary or the hex format .,,So when i try doing the following --

    radioMsg[2]=1000;

    radioMsg[3]=600;

    radioMsg[4]=724;

    I am not able to send it ,since radioMsg is declared as unsigned int8_t (max val=256). so wat exactly do u mean by making the message multiple bytes long in this context of integer numbers ranging from 0 to 1024 ..??

    Niketh M G 


    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • H Stewart
    Posted by H Stewart
    on Jun 02 2010 23:03 PM
    Mastermind8175 points

    You can see in the code editor  I set adc_LOW = ADCL and adc_HIGH = ADCH From the watch box you can see they are unsigned char (8 bits) and could be sent as 2 separate 8 bit bytes via the radio and combined into a uint16 on the receiving end of the link. When combine they will be the same as adc_result. The radio's Tx and Rx buffers are only 8 bits so that is all they can send. Of course the OTA packet is longer but it is made up of streaming 8 bits chunks.

    In the debugger  watch box I repeated the labels with both hex and decimal formats. I entered 29632 into the calculator as decimal and switched to binary to see the bit pattern. It is 16 bits but the first bit is 0 and does not display. Since it is a single ended measurement the first bit is 0 because it is a positive two's compliment number. There are a lot of zero to the right because it is a 10 bit measurement in a 16 bit memory allocation. With >>6 it could be push to the right so the zeros are to the left

    As you can see I could not get all of the way to Vref due to my board design. I got to 463 decimal out of 511 which is 463/511 x 1.25vref = 1.13 or about .12v under.

     

     

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • H Stewart
    Posted by H Stewart
    on Jun 02 2010 23:15 PM
    Mastermind8175 points

    Ps  The code should have been

    adc_LOW =  ADCL  & 0xC0;  // 0xC0 is needed to mask the 6 undefined bits that are not used
    adc_HIGH = ADCH;                // All 8 bits are used therefore no mask is required

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • niketh
    Posted by niketh
    on Jun 03 2010 07:57 AM
    Prodigy220 points

    Hey Thank you very much I got ur idea .and will implement that ..

    I have another question..

    I compiled the UART_......_ISR.c example code that TI has provided. It works this way,after transmission of a byte ,an interrupt is triggered off , which then takes the command to the TX_ISR service routine (the file and function names i have mentioned aren't matching with the real ones..i sort of dun remember the actual names )...

    But on debugging ,i found no way to manually generate an interrupt so that i could go through the ISR function .... and it wasnt clear as to wat data format it was  transmitting ..

    EXAMPLE : If i had to transmit 5 ,  As far as i think we need to input the ASCII of 5(0x35) to the TX buffer .since it works on ASCII coding technique .So my doubt is whether i have to do this conversion to ASCII manually or can we do it without that ,??

    Say if i want to transmit 245 ,Thn without doing anything a value of 0xF5(245) goes into the U0DBUF ....Will i receive the same 245 on the receiving end ..??.

    Or Do i need to convert each digit(2,4,5) to their ASCII equivalent in hex and then send each individually one after the other ???

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • H Stewart
    Posted by H Stewart
    on Jun 03 2010 09:43 AM
    Mastermind8175 points

    When you write

    U0DBUF = whatever;    "whatever"  is sent. You know U0DBUF is a 8 bit buffer so you are limited to 8 bits. There is not a automatic converter that converts anything to ASCII.

    If you set 

    uint8_t whatever;
    whatever = 5;
    U0DBUF = whatever;

    then 00000101 will be sent because the compiler recognizes 5 as decimal and does the conversion to binary and from the uint8 knows to allocate 8 bits of storage.

    If you set 

    uint8_t whatever;
    whatever = 0x05;
    U0DBUF = whatever;

    then 00000101 will still be sent because the compiler recognizes 0x05 as hex and does the conversion to binary and from the uint8 knows to allocate 8 bits of storage.

    The following will get you a ASCII 5

    #include <string.h>
    char whatever;
    whatever = '5';
    U0DBUF = whatever;

    then 00110101 will be sent because the compiler recognizes 5 as a ASCII and uses the a library to do the conversion  to binary and from the char knows to allocate 8 bits of storage.

    Here is the code and watch box.  To handle long strings of alpha numeric's  really requires the #includes string.h and stdio.h With limits on code size with the free version of IAR and the limited memory of the Ti SOC it is sometimes easier to just look up and use the ascii value in hex if you only have a few alpha characters.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use