BL4S100 delay rutine and conversion analog to digital

Nestor Hernandez <micros_1980-/[email protected]>
Newsgroups gmane.comp.hardware.rabbit-semiconductor
Message-ID <[email protected]>
Hello,
This is the
first time I use a bl4s100. I created a program to made data acquisition of 50
point, between each point there is a delay of 100 ms. The delay time is
calculate using this equation Td= Mc*(13*Ni+6)*(32*No+6), where Mc is the time
per machine cycle, and Ni and No represent immediate values load into HL and
BC, respectively. 

The program compile and run well, the problems is on
conversion analog to digital does not work and the delay time neither. Someone 
could help me, in order to make this program work well. Is there any other way
to create a delay routine of 100 ms?
Thanks in
advance,
 
I add the
program
#use
"BL4S1xx.LIB"
main ()
{
   int tiempo,i,a;
   auto char buffer[10];
   auto float Volts1,Volts2,A1,A2,*a1,*a2;
   auto float Volts_A1[50],Volts_A2[50];
 
   brdInit();
 
   printf("\nPRESS ENTER TO
START\n");
   gets(buffer);
 
   for ( i = 0; i <50; i++)
       {
            Volts1=anaInVolts(1,1);
                        Volts2=anaInVolts(2,1);
                        A1=(10*Volts1);
                        A2=(0.5*Volts2)-1,1389;
            a2=&A2;
                        a1=&A1;
                        Volts_A1[i]=*a1;
                        Volts_A2[i]=*a2;
 
            #asm
            PUSH  AF;
            PUSH  BC;
            PUSH  HL;
            LD                  BC,0x17h;
OUTER:                      LD                   HL,0x19Fh;
INNER:                       DEC    HL;
                                               LD                   A,H;
            OR      L;
            JP    NZ, INNER;
            DEC    BC;
            LD                  A,B;
            OR                  C;
            JP                    NZ,OUTER;
            POP    HL;
            POP    BC;
            POP    AF;
            #endasm
                        printf("%f\t
%f\t %d\n",Volts_A1[i],Volts_A2[i], i);
                        }
  }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.