piclist 1997\05\29\115917a >
Thread: New To PIC What am I doing wrong?
face BY : Eric Martens email (remove spam text)

This may be the cause of the problem ( i had a same kind of problem on a 68000)

A program written in assembler will work quicker then the same program written
in basic
or another language. The overhead of the program is less or none if you write in
assembler. When you write in a langauge other then assembler the program listing
(compiled program) tends to be longer, thus resulting in a longer runtime on the

Greetings Eric Martens

*  Eric Martens           *
*  EraseMEemarspam_OUTspamknoware.nl  *

| From: Glen Benson <bensonRemoveMEspamBENSONASSOC.COM>
| To: RemoveMEPICLIST.....spamspamMITVMA.MIT.EDU
| Subject: New To PIC What am I doing wrong?
| Date: donderdag 29 mei 1997 14:08
| Hi,
|   I am new to PIC, cant get a handle on asm fast enough. So I bought a
| basic compiler. I can write all sorts of neat things I dont need to do, But
| I cant get the following code to work in less than about 2 seconds. I need
| to take an ADC reading stuff it in to a varible and send it to the PC via
| lpt port. For my test I use qbasic and turn on Pin 7 of the PIC with the
| (out lpt,1 statement) then
| I read the level of pin 6 on the pick to see if hi or low then I shift the
| value in B0 , and do it 7 more times. I have to put 2 second delays in the
| qbasic code
| to make it work. Thats .5 hz (its got to go faster than that). Please if
| you see my blunder, can you show me? :)
| ' a qbasic program turns on PIN 7, then the qbasic prog. reads
| ' the value on (lpt pin10) connected to (PIC on PIN 6) and repeats
| ' 8 times toget the whole byte. The qbasic prog has to have
| ' 2 second delays to get the right data. How could this
| ' be written better? It cant get worse.
| Symbol  DDIR = Dir6           ' Shift data pin direction is Dir1
| Symbol  DPIN = Pin6           ' Shift data pin is 6
| Symbol  CPIN = 1              ' Shift clock pin is 1
|         input 7               ' Make pin 7 an input
| START:  B0=65                 ' value to shift out
| loop: pause 1                 'didnt seem to work without this
|       if pin7=1 then getbit   ' pin 1 from lpt just went high
|       goto loop
| getbit: DDIR = 1             ' set the direction of the pin
|         DPIN = bit0          ' get the bit send it out to pin 10 on lpt
|         B0=B0/2              ' shift the value in B0 over
|         goto loop
| Thanks
| Glen Benson
<199705291556.RAA19762@utrecht.knoware.nl> 7bit

See also: www.piclist.com/techref/microchip/devices.htm?key=pic
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) New To PIC What am I doing wrong?

month overview.

new search...