<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: error in variables handling in Processor Expert Software</title>
    <link>https://community.nxp.com/t5/Processor-Expert-Software/error-in-variables-handling/m-p/201045#M764</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regarding the types:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- char - can be signed or unsigned depending on the compiler, it can usually be configured in the compiler settings. &lt;/P&gt;&lt;P&gt;- byte - is defined by Processor Expert as unsigned char (8 bits)&lt;/P&gt;&lt;P&gt;- int - is signed, on HCS08 16 bits&lt;/P&gt;&lt;P&gt;- word - unsigned int, on HCS08 16 bits&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure what component do you use for the communication. If you use SynchroMaster, then the type of the sent/received data (ComponentName_TComData),&amp;nbsp; is a byte if the number of information bits ( Width property) is less than or equal to 8. If the number of information bits is greater than 8, the type of the user type ComponentName_TComData is a word.&lt;/P&gt;&lt;P&gt;I recommend to not use char and int in you r functions like RTCwrite, if you want to do bit-wise operations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the width and spi bus settings with the manual of the part and please post some sample project if you'll keep having troubles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;Petr Hradsky&lt;/P&gt;&lt;P&gt;Processor Expert Support Team&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Dec 2012 12:20:06 GMT</pubDate>
    <dc:creator>Petr_H</dc:creator>
    <dc:date>2012-12-18T12:20:06Z</dc:date>
    <item>
      <title>error in variables handling</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/error-in-variables-handling/m-p/201044#M763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;processor expert is making fun of me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i'm trying to attach an st m41t94 rtc to the mc9s08dz128mll using the spi2, but since i've got other stuff in the same bus, i'm using a 74hc595 sipo register for the slave selects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i'm trying to make an echo access to the clock to try out the spi. this is part of my main&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;///&lt;/P&gt;&lt;P&gt;RTCwrite(0x02, 0x15);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // (1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; spiError= RTCread(0x02,time);&lt;/P&gt;&lt;P&gt;&amp;nbsp; a=*time;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SIPO1Tx(a, TRUE, TRUE);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;///&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i'm writting, then reading, then placing what i read on a second sipo driving leds&lt;/P&gt;&lt;P&gt;the following lines are in another file&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;///&lt;/P&gt;&lt;P&gt;void RTCwrite(char RTCaddress, char data)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // (2)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; RTCaddress = RTCaddress | 0x80; //turn on first bit to write&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // (3)&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPI2SIPOTx(0xFD, TRUE);&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPI2M_SendChar(RTCaddress);&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPI2M_SendChar(data);&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPI2SIPOTx(0xFF, TRUE);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;///&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1)&amp;nbsp; you can see how i'm sending a hex 2 and 15 to the rtc, i'm trying to access address register 2 which contains the minutes of the rtc and i'm telling it in bcd that rigth now its been 15 minutes.&lt;/P&gt;&lt;P&gt;(2) but when i run the debugger, RTCaddress has a 0x41 while data has the 0x15 i was sending. ??&lt;/P&gt;&lt;P&gt;(3) to tell the rtc that i'm writting i need to turn on the first bit of the address. so ideally i'll get 0x02 | 0x80 = 0x82. in this case i'd expect to have 0x41 | 0x80 = 0xc1, but i still get RTCaddress = 0x41. ????&lt;/P&gt;&lt;P&gt;given how this is no way working, i havent even tried the rest so i dont know if it works, at this point i dont care. all i care is why this stuff is not working??&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;next i tried this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;///&lt;/P&gt;&lt;P&gt;RTCwrite(0x0002, 0x15);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // (1)&lt;/P&gt;&lt;P&gt;&amp;nbsp; spiError= RTCread(0x02,time);&lt;/P&gt;&lt;P&gt;&amp;nbsp; a=*time;&lt;/P&gt;&lt;P&gt;&amp;nbsp; SIPO1Tx(a, TRUE, TRUE);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/////////////////&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void RTCwrite(int RTCaddress, char data)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; RTCaddress = RTCaddress | 0x80; //turn on first bit to write&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // (2)&lt;/P&gt;&lt;P&gt;&amp;nbsp; data = data | 0x80;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // (3)&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPI2SIPOTx(0xFD, TRUE);&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPI2M_SendChar(RTCaddress);&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPI2M_SendChar(data);&lt;/P&gt;&lt;P&gt;&amp;nbsp; SPI2SIPOTx(0xFF, TRUE);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;///&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) this way the number pass nicely&lt;/P&gt;&lt;P&gt;(2) the operation works, i got a 0x0082&lt;/P&gt;&lt;P&gt;(3) but here this operation is ignored&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so all i can conclude is processor experts (or code warrior) doesn't knows how to handdle chars&lt;/P&gt;&lt;P&gt;but i need the number as a char, not int, i could make a cast and truncate the int, but i dont think thats correct&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;also, are the following assumption correct?&lt;/P&gt;&lt;P&gt;byte = signed byte = sign + 7 bits&lt;/P&gt;&lt;P&gt;char = unsigned byte = 8 bits&lt;/P&gt;&lt;P&gt;int = signed double byte = sign + 15 bits&lt;/P&gt;&lt;P&gt;word = unsigned int = 16 bits &lt;/P&gt;&lt;P&gt;are short and long also available? and what would be their counterparts?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please help me out&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 08 Dec 2012 18:21:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/error-in-variables-handling/m-p/201044#M763</guid>
      <dc:creator>GMVS</dc:creator>
      <dc:date>2012-12-08T18:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: error in variables handling</title>
      <link>https://community.nxp.com/t5/Processor-Expert-Software/error-in-variables-handling/m-p/201045#M764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regarding the types:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- char - can be signed or unsigned depending on the compiler, it can usually be configured in the compiler settings. &lt;/P&gt;&lt;P&gt;- byte - is defined by Processor Expert as unsigned char (8 bits)&lt;/P&gt;&lt;P&gt;- int - is signed, on HCS08 16 bits&lt;/P&gt;&lt;P&gt;- word - unsigned int, on HCS08 16 bits&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure what component do you use for the communication. If you use SynchroMaster, then the type of the sent/received data (ComponentName_TComData),&amp;nbsp; is a byte if the number of information bits ( Width property) is less than or equal to 8. If the number of information bits is greater than 8, the type of the user type ComponentName_TComData is a word.&lt;/P&gt;&lt;P&gt;I recommend to not use char and int in you r functions like RTCwrite, if you want to do bit-wise operations.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the width and spi bus settings with the manual of the part and please post some sample project if you'll keep having troubles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;best regards&lt;/P&gt;&lt;P&gt;Petr Hradsky&lt;/P&gt;&lt;P&gt;Processor Expert Support Team&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Dec 2012 12:20:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Processor-Expert-Software/error-in-variables-handling/m-p/201045#M764</guid>
      <dc:creator>Petr_H</dc:creator>
      <dc:date>2012-12-18T12:20:06Z</dc:date>
    </item>
  </channel>
</rss>

