<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://forums.obdev.at/app.php/feed/topic/6444" />

	<title>Objective Development Forums</title>
	
	<link href="https://forums.obdev.at/index.php" />
	<updated>2012-02-12T11:52:13+02:00</updated>

	<author><name><![CDATA[Objective Development Forums]]></name></author>
	<id>https://forums.obdev.at/app.php/feed/topic/6444</id>

		<entry>
		<author><name><![CDATA[ageurtse]]></name></author>
		<updated>2012-02-12T11:52:13+02:00</updated>

		<published>2012-02-12T11:52:13+02:00</published>
		<id>https://forums.obdev.at/viewtopic.php?t=6444&amp;p=20949#p20949</id>
		<link href="https://forums.obdev.at/viewtopic.php?t=6444&amp;p=20949#p20949"/>
		<title type="html"><![CDATA[why aren't my 1024 bytes proccesd]]></title>

		
		<content type="html" xml:base="https://forums.obdev.at/viewtopic.php?t=6444&amp;p=20949#p20949"><![CDATA[
Hello, <br /><br />i have the bellow code, it work's fine if a send 8 portion's of 128 bytes. if i alter it to 1 portion of 1024 bytes it receives them all. the report is 1024 but when i procces it the avr report -xx so what goes wrong. the code posted below is for proccesing 1024 bytes.<br /><br /><div class="codebox"><p>Code: </p><pre><code>#include &lt;inttypes.h&gt;<br />#include &lt;avr/io.h&gt;<br />#include &lt;avr/interrupt.h&gt;<br />#include &lt;avr/pgmspace.h&gt;<br />#include &lt;avr/wdt.h&gt;<br />#include &lt;avr/eeprom.h&gt;<br />#include &lt;util/delay.h&gt;<br /><br />// Graphical drivers<br />#include &quot;ks0108.h&quot;<br />#include &quot;arial8.h&quot;<br /><br />// use avrusb library<br />#include &quot;usbdrv.h&quot;<br />#include &quot;oddebug.h&quot;<br />#include &quot;request.h&quot;<br />#include &quot;bitmap.h&quot;<br /><br /><br />#define VERSION_MAJOR 1<br />#define VERSION_MINOR 9<br />#define VERSION_STR &quot;1.09&quot;<br /><br /><br />/* ------------------------------------------------------------------------- */<br />static uchar currentPosition, bytesRemaining;<br />static uchar image&#91;1024&#93;;<br />uint8_t x,y,color;<br /><br />/* ------------------------------------------------------------------------- */<br />uchar   usbFunctionSetup(uchar data&#91;8&#93;) {<br />    usbRequest_t    *rq = (void *)data;<br />   static uchar    replyBuf&#91;4&#93;;<br /><br />   <br /><br /> //   usbMsgPtr = replyBuf;<br />   currentPosition = 0;<br />   bytesRemaining = rq-&gt;wLength.word;  // store the amount of data requested<br />    if(bytesRemaining &gt; sizeof(image)) // limit to buffer size<br />       bytesRemaining = sizeof(image);<br /><br />    if(rq-&gt;bRequest == cmd_LCD_WritePixel){  /* ECHO */<br />        x = rq-&gt;wValue.bytes&#91;0&#93;;<br />        y = rq-&gt;wValue.bytes&#91;1&#93;;<br />      color = rq-&gt;wIndex.bytes&#91;0&#93;;<br />      ks0108SetDot(x,y,color);<br />    }<br /> <br />    if(rq-&gt;bRequest == cmd_USB_connected){  /* repaint screen on connect */<br />        ks0108ClearScreen();<br />      ks0108SelectFont(Arial9, ks0108ReadFontData, BLACK);<br />      ks0108GotoXY(8,10);<br />      // Print some text<br />      ks0108Puts_P(PSTR(&quot;GLCD-USB  interface by AJG&quot;));<br />      ks0108GotoXY(25,20);<br />      // Print some text<br />      ks0108Puts_P(PSTR(&quot;Connected to host PC&quot;));<br />      ks0108DrawRoundRect(0, 0, 126, 63, 8, BLACK);<br />   } <br />  <br />    if(rq-&gt;bRequest == cmd_USB_sendglcd1){  /* repaint screen on connect */<br />        x = 0;<br />        y = rq-&gt;wValue.bytes&#91;1&#93;;<br />      return USB_NO_MSG;     <br />   } <br /><br /><br />  return 0;  // reply len<br />}<br /><br /><br /><br />uchar usbFunctionWrite(uchar *data, uchar len)<br />{<br />    uchar i;<br />    uint16_t ii, jj, by;<br /><br />   if(len &gt; bytesRemaining)            // if this is the last incomplete chunk<br />       len = bytesRemaining;               // limit to the amount we can store<br /><br /><br />    bytesRemaining -= len;<br />    for(i = 0; i &lt; len; i++){<br /><br />//         ks0108GotoXY(x, y);<br />//         ks0108WriteData(data&#91;i&#93;);<br />//         x++;<br /><br />      image&#91;currentPosition++&#93; = data&#91;i&#93;;<br /><br /><br />      }<br /><br />   /* after all data is proccesd execute below */<br />   if (bytesRemaining ==0){ <br />            for(z=0; z&lt;64; z+=8)<br />      for(j=0; j&lt;128; j++)<br />      {<br />         by=image&#91;(z*16)+j&#93;;<br />         ks0108GotoXY(j, z);<br />         ks0108WriteData(by);<br />      }<br />   }<br />   return bytesRemaining == 0;             // return 1 if we have all data<br />}<br /></code></pre></div><p>Statistics: Posted by <a href="https://forums.obdev.at/memberlist.php?mode=viewprofile&amp;u=6237">ageurtse</a> — Sun Feb 12, 2012 11:52 am</p><hr />
]]></content>
	</entry>
	</feed>
