piclist 2000\12\16\003804a >
Thread: 0831 routine
www.piclist.com/techref/ubicom/devices.htm?key=sx
flavicon
face BY : Dan Michaels email (remove spam text)



At 09:59 PM 12/15/00 +0930, you wrote:
>hi,
>whenever the main program call the subroutine below I get garbages
>I hope somebody can point out my mistake cause I don't see what is
>wrong with it.
>
>thanks
>
>;this routine read the ADC0831
>adc     setb    cs                      ;cs high (ra.1)
>        setb    clk                     ;clk high (ra.0)
>        mov     trk,#8                  ;number of time to loop
>        clrb    cs                      ;enable the 0831
>        clrb    clk                     ;start convertion
>        nop
>        setb    clk
>        nop
>loop    clrb    clk
>        mov     data,rb                 ;read the 0831
>        setb    clk
>        rr      rb                      ;shift data to the right (rb.7 is
the input)
>        djnz    trk,loop                ;is loop over if not loop again
>        mov     flash,rb                ;save data
>        ret                             ;return to the main program
>

Maybe:

loop    clrb    clk
       mov     temp,rb                 ;read the 0831
       setb    clk
       rl      temp
       rr      data                      ;shift data to the right (rb.7 is
the input)
       djnz    trk,loop                ;is loop over if not loop again
       mov     flash,data                ;save data
       ret                             ;return to the main program

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spamlistservspammitvma.mit.edu with SET PICList DIGEST in the body


<1.5.4.16.20001215215715.3b67ad9a@pop.dnvr.uswest.net>

See also: www.piclist.com/techref/ubicom/devices.htm?key=sx
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) 0831 routine

month overview.

new search...