Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/15/05 02:43
Read: times


 
#89685 - counting is getting difficult
Responding to: ???'s previous message
I guess all would have figured out im new to microcontrollers and programming.
I just typed this long message and BOOM my network crashed...I couldnt post it.(how frustrating)
Anyways....I've written separate functions for all characters to be printed....
say for A
A()
{
/***
the list of pins in the required order to be fired
****/
}
so on for all charaters...( I have about a hundred)

In my main...I get into an infinite loop and call all these functions one by one...
My original idea was to get out of the loop and the end of the line(based on time) and then after my paper feed and setting reference get back into the loop.
I'v dropped that now.

while(1)
{
A();
B();
.
.
.
.
goes on till hundred.
}

Couting characters is getting very difficult..I need to check after every character...the code is getting too long..

I was wondering if there is a shorter way to it?

cnt=0;
while(1)
{
A();
cnt++
if(cnt==max)
{
/****
pf(); //paper feed function
ref(); //set reference for next line
****/
}

B();
if(cnt==max)
{
/****
pf(); //paper feed function
ref(); //set reference for next line
****/
}

....
goes on a hundred..
}

doesnt this get too long.

I was thinking if i include my pf() and ref() in my ISR would it be possible ?

void time(void) interrupt 3
{
pf();
ref();
}

This way i thought it would get much simpler..
Can i do this?
I've heard people say that ISRs should be as short as possible..
The pf() takes about 20ms.

I know my questions would have annoyed a lot of you...(i told you im new to this)
I am really gratefull to each and everyone of you..(you people have been really helpfull)
Thank you
-rahul



List of 53 messages in thread
TopicAuthorDate
problem with labels            01/01/70 00:00      
   First of all....            01/01/70 00:00      
   Jump to a specific point            01/01/70 00:00      
      Don't Do It!!            01/01/70 00:00      
         DO it!            01/01/70 00:00      
            No, don't!            01/01/70 00:00      
      Same label problem            01/01/70 00:00      
      Message Not Useful?            01/01/70 00:00      
         (-1 Message Not Useful)            01/01/70 00:00      
            Your wish...            01/01/70 00:00      
   break            01/01/70 00:00      
      this is for a printer            01/01/70 00:00      
         Bizarre!            01/01/70 00:00      
            Proportional font?            01/01/70 00:00      
               count columns            01/01/70 00:00      
                  columns?            01/01/70 00:00      
                     intelligent            01/01/70 00:00      
                  line printers            01/01/70 00:00      
                     hit me with a thud            01/01/70 00:00      
                        DP Lineprinters            01/01/70 00:00      
         breaking out of loops            01/01/70 00:00      
   the RETI barrier            01/01/70 00:00      
      The clever 8051 designers!            01/01/70 00:00      
         Clever            01/01/70 00:00      
         Bunch of bull.            01/01/70 00:00      
            RE:Bunch of bull.            01/01/70 00:00      
               Mehdi            01/01/70 00:00      
   Don't start from here            01/01/70 00:00      
   sdcc says unreachable code !            01/01/70 00:00      
      You get rid of it by....            01/01/70 00:00      
      Just don't do it!            01/01/70 00:00      
      Structure            01/01/70 00:00      
      global and local variables            01/01/70 00:00      
         Re:            01/01/70 00:00      
            Give It Up Rahul.            01/01/70 00:00      
            Man @ bottom of hole should stop digging            01/01/70 00:00      
               Man @ bottom of hole            01/01/70 00:00      
                  Stop digging!!            01/01/70 00:00      
                  OK, here it is!            01/01/70 00:00      
                     counting is getting difficult            01/01/70 00:00      
                        Counting should be easy!            01/01/70 00:00      
                           as a starter...            01/01/70 00:00      
                              solved !            01/01/70 00:00      
            Back to Basics            01/01/70 00:00      
      Blinker            01/01/70 00:00      
         need to jump..            01/01/70 00:00      
            Do NOT jump!            01/01/70 00:00      
            Timer            01/01/70 00:00      
   Lookup Table Character Generator            01/01/70 00:00      
      bit based lookup table            01/01/70 00:00      
         Try this:            01/01/70 00:00      
      Character building            01/01/70 00:00      
      Things are working good..            01/01/70 00:00      

Back to Subject List