<?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: 9S08QG8 TABS READ in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135392#M3989</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Welcome to the forum Fabio.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I think you should post a sample of your assembly code that is not working correctly.&amp;nbsp; Then we will be able to better diagnose your problem, without the need for a lot of guesswork.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 May 2007 12:18:49 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2007-05-31T12:18:49Z</dc:date>
    <item>
      <title>9S08QG8 TABS READ</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135391#M3988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Hello!&lt;BR /&gt;I'm new in the forum and I have a little problem with assembly code for a MC9S08QG8 microcontroller.&lt;BR /&gt;I cannot read a table with dates of a one byte with the LDX command, I wrong command or I to do use other instruction? I change from ST6 and 80198 to 9S08 family but in this micro I have a big problem.&lt;BR /&gt;I don't understand way it doesn't work, so if any body can help me I will appreciate it.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Thank you very much!&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;FABIO FUMAGALLI&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2007 12:06:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135391#M3988</guid>
      <dc:creator>fuma</dc:creator>
      <dc:date>2007-05-31T12:06:50Z</dc:date>
    </item>
    <item>
      <title>Re: 9S08QG8 TABS READ</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135392#M3989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Welcome to the forum Fabio.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I think you should post a sample of your assembly code that is not working correctly.&amp;nbsp; Then we will be able to better diagnose your problem, without the need for a lot of guesswork.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2007 12:18:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135392#M3989</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-05-31T12:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: 9S08QG8 TABS READ</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135393#M3990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Fabio,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Welcome to the forums.&lt;/DIV&gt;&lt;DIV&gt;You seem to have posted the same question 3 times???&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;How about you give us a sample of the code you are trying and tell us how big the table is etc and we might be able to point you in the right direction.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2007 12:22:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135393#M3990</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2007-05-31T12:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: 9S08QG8 TABS READ</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135394#M3991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Fabio,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;When I suggested you post your assembly code, I did not actually mean to send me the code via PM.&amp;nbsp; The purpose of the forum is to provide for open discussion of the topics raised, with the assumption that any answers given might possibly help others, as well as yourself.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;With this in mind, the following is the contents of the PM -&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;HR /&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Fabio wrote:&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello!&lt;BR /&gt;hanks for the respost and excuse me for 3 times of the identical question.&lt;BR /&gt;I cannot read a table with dates of a one byte with the LDX command, I wrong command or I to do use other command/instruction.&lt;BR /&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The tabs in future is 256 byte for generate a PWM 8 bit sine, the tab in the attach is only for example of data read.&lt;BR /&gt;I don't understand way it dosen't work, so if any body can help me I will appreciate it.&lt;BR /&gt;&lt;BR /&gt;Thank you very much!&lt;BR /&gt;&lt;BR /&gt;Fabio&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="Courier New"&gt;mainLoop:&lt;BR /&gt;; Insert your code here&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; LDHX #$F4&lt;BR /&gt;&amp;nbsp;&amp;nbsp; STHX TPMC1V&lt;BR /&gt;&amp;nbsp;&amp;nbsp; MOV #$28,TPMSC&lt;BR /&gt;&lt;BR /&gt;mainLoop1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; NOP&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ldX #TabSin-1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; aix #1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; pshh&lt;BR /&gt;&amp;nbsp;&amp;nbsp; pshx&lt;BR /&gt;&amp;nbsp;&amp;nbsp; lda x&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; STHX TPMC1V&lt;BR /&gt;&amp;nbsp;&amp;nbsp; MOV #$28,TPMSC&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; pulx&lt;BR /&gt;&amp;nbsp;&amp;nbsp; pulh&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; feed_watchdog&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STA SRS ; feed the watchdog&lt;BR /&gt;&amp;nbsp;&amp;nbsp; BRA mainLoop1&lt;BR /&gt;&lt;BR /&gt;XDEF TabSin&lt;BR /&gt;&lt;BR /&gt;; tabella generazione sinusoide&lt;BR /&gt;TabSin:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; ds.b 10&lt;BR /&gt;&amp;nbsp;&amp;nbsp; dc.w 50&lt;BR /&gt;&amp;nbsp;&amp;nbsp; dc.w 50&lt;/FONT&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;HR /&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT face="Arial"&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Arial"&gt;&lt;FONT size="2"&gt;Firstly, your requirements for TPM use are totally unclear to me.&amp;nbsp; There seems to be some confusion about timer overflow operation, and timer channel operation.&amp;nbsp; Substantial revision of the code in this area is likely to be necessary.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Arial"&gt;&lt;FONT size="2"&gt;But to address your actual query concerning reading byte values from a data table ...&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;&lt;FONT face="Arial"&gt;&lt;FONT size="2"&gt;If the table is to consist of data bytes (not words), the directive &lt;FONT face="Courier New"&gt;&lt;FONT color="#FF6600"&gt;dc.b&lt;/FONT&gt;&lt;/FONT&gt; must be used consistently, not &lt;FONT face="Courier New"&gt;ds.b&lt;/FONT&gt; or &lt;FONT face="Courier New"&gt;dc.w&lt;/FONT&gt; as you currently have.&amp;nbsp; Note that &lt;FONT face="Courier New"&gt;&lt;FONT color="#FF6600"&gt;dc.b&amp;nbsp; 10,50,50&lt;/FONT&gt;&lt;/FONT&gt; is also permissible, to reduce the number of lines.&amp;nbsp; You will need to refer to the CW assembler manual for information about assembler directives.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/LI&gt;&lt;LI&gt;&lt;FONT size="2"&gt;The most straighforward way to read a single byte value from the table (of size not exceeding 256 bytes) -&lt;BR /&gt;Firstly set X-register to the table index value&amp;nbsp;that you require (0-255), then use the following instructions to fetch the byte value in the accumulator.&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT color="#FF6600" face="Courier New" size="2"&gt;&amp;nbsp;&amp;nbsp;CLRH&lt;BR /&gt;&amp;nbsp;&amp;nbsp;LDA&amp;nbsp;&amp;nbsp;&amp;nbsp;TabSin,X&lt;/FONT&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;FONT size="2"&gt;After processing each byte, if you then need to increment the index value in order to read the next byte, either of the following instructions could be used, even though&amp;nbsp;operation is a little different &amp;nbsp;in each case -&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;FONT color="#FF6600" face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;INCX&lt;BR /&gt;&lt;/FONT&gt;or&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT color="#FF6600" face="Courier New"&gt;&lt;FONT size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;AIX&amp;nbsp;&amp;nbsp; #1&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT color="#666666" face="Arial" size="2"&gt;Regards,&lt;BR /&gt;Mac&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;BR /&gt;Message Edited by bigmac on &lt;SPAN class="date_text"&gt;2007-06-02&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;03:10 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Jun 2007 00:05:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135394#M3991</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-06-02T00:05:53Z</dc:date>
    </item>
    <item>
      <title>Re: 9S08QG8 TABS READ</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135395#M3992</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Fabio,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Further to what Mac has said...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Reasons why your code won't work:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;1. Your initialising the index register inside the loop instead of before you go into it. Never will walk through the table but just always read the first entry.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;2. lda x should be lda ,x. Does CW accept this?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;3. You never use the value obtained from the table that is held in A.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;4. If you want to automatically roll around in a 256 byte table you should use INCX rather than AIX&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;5. You have not initialised the H register. Works here as never touched but should be done.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;6. You are pushing and pulling H for no apparent reason.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;7. No offset indexing mode is no good to you for a 256 byte table as you do not have all of page zero available to you. The low end of page zero is occupied by the registers. You need to follow Mac's&lt;/DIV&gt;&lt;DIV&gt;suggestion here and use INCX.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;8. You most likely need something to 'pace' the loop otherwise it is going to spin around very fast.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am not going to try to figure out what you are trying to do with the timers.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 02 Jun 2007 06:44:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135395#M3992</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2007-06-02T06:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: 9S08QG8 TABS READ</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135396#M3993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Ok, thanks&amp;nbsp;to all for the help,&lt;/DIV&gt;&lt;DIV&gt;today I&amp;nbsp;check it.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards&lt;/DIV&gt;&lt;DIV&gt;Fabio&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jun 2007 11:42:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-TABS-READ/m-p/135396#M3993</guid>
      <dc:creator>fuma</dc:creator>
      <dc:date>2007-06-04T11:42:41Z</dc:date>
    </item>
  </channel>
</rss>

