On Sat, Nov 06, 2010 at 03:36:42PM -0700, Kirk Wallace wrote:
> On Sat, 2010-11-06 at 11:49 -0700, Kirk Wallace wrote:
> > I am starting to think about how to put an eight bit word on a parallel
> > port. My first guess is to load Parport, then write a component that
> > shifts an unsigned variable a bit at a time to each parport pin, but I
> > wonder if there is a cleaner way to write the whole (8bit) word to, lets
> > say, pins 2-9? This will be used with a strobe component to latch data
> > to an AVR port.
> 
> It turns out this is pretty trivial:
> http://www.wallacecompany.com/machine_shop/EMC2/AVR/conv_u32_8bits.comp 

Kirk, to grab the lowest byte of a uint32_t, I'd be tempted to just do a
typecast in an assignment:

In file: test1.c >>>

#include <stdint.h>

int main ()
{  
   
uint32_t given  ;    
uint8_t  needed ;
   
   needed = (uint8_t) given ; 
   
}

<<<

$ gcc test1.c -Wa,-ahdl=test1.lst

That compiles without errors, and gives some intel assembler in
test1.lst, with (satisfyingly) a "movb" in the middle of it. The rest is
stage setting, AFAICT. (8 bit intel is OK by me, but I haven't grubbed
in x86, so I have to squint and guess that much of it is preamble and
postample, pushing and popping a stack frame.)

Now there's just the write of the uint8_t to the parport address, and
pulse the strobe line, as you've mentioned. (i.e. the tricky part,
unless an oscilloscope is to hand to check the (presumably) software
timing of the strobe duration.)

Erik

-- 
I've had a perfectly wonderful evening.
But this wasn't it.
                         - Groucho Marx

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Emc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to