Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Ecp Port Project: help me optimize my code

Status
Not open for further replies.

aamiralikhoja

Member level 5
Joined
Aug 11, 2004
Messages
90
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
708
Ecp Help

Dear Fellows.


I am working on Ecp Port Project Port ECP Works Fine . I am taking data

from microcontroler at 16Bytes/Sec and storing it in memory buffer. after

storing, I am writting data to hard disk this programm works fine in dos using

watcom c compiler but data is lost when running in windows 98 ,using visual c

compiler. I am using P-3 PC. Iam using following psedo code.

Checking Fifo full flag in my visual c programm after Fifo filled . i read fifo through following code
do
{
do
{
}while(!fifofull);
for(i =0;i<16;i++)
buffer[i+j] = inport(fifiaddr);
j = j +16
}}while(buffer ! full);
where buffer is 1MB memory.
How to store and process data in such conditions in MS Windows. How to
optimized this code . I heared data Ecp can trasfer data at IMBits/Sec How
it can be done.pleas reply.
 

Ecp Help

Your code is hard to read - no indenting, curly braces don't match, syntax error "buffer ! full".

It sort-of looks like your loop waits until the FIFO is full before it begins reading any of the bytes. That would cause continuous 100% CPU utilization (highly anti-social Windows behavior), and defeats most of the purpose of having a FIFO (you risk overflow if bytes 16 and 17 arrive close together).

Do you really mean only sixteen bytes per second? Simply start a 20 Hz timer that checks the FIFO empty flag and inputs all available bytes.
 

Re: Ecp Help

Dear

Thanks for reply. It is not syntax error but spelled incorrectly.

Aactually data is comming at 16KBytes/Sec and , I waits

untill Fifo Becomes Full after Fifo filled Iam reading the

whole Fifo and loop again to check fifoFull Flag.How To read Fifo

so that there is no loss of data.I am using my application in

console type project. Next I will move MFC project.
 

Ecp Help

16K bytes/sec makes a big difference. If your external hardware device has no FIFO buffer, then you probably cannot make a purely software input loop work reliably under Windows due to multitasking delays. A 1kHz multimedia timer and 16-byte ECP FIFO comes very close to your requirement, but it will probably just barely fail. In that case, you'll need a device driver that uses interrupts and maybe DMA. Big project! Hopefully you can add an external FIFO to avoid that headache.

Some discussion about drivers:
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top