Sign in

username:

password:



Not a member?

Search piclist



Search tips

Subscribe to piclist



piclist by Keywords

12F675 | 16F628 | 16F84 | 16f877 | 16F877A | 16F88 | 18F458 | ADC | AVR | Bootloader | CAN | CCS | CRC | EAGLE | EEPROM | ICD | ICSP | IDE | JDM | LED | Macros | Microchip | MPLAB | PCB-CAD | PIC10F | Pic12f675 | PIC16F84 | PIC16F84A | PIC16F877 | PIC18 | PIC18F452 | PicBasic | PICC | PICSTART | PWM | RS-485 | RS232 | SMT | SPI | UART | USART | USB | Wireless | Wisp628 | Xilinx

Ads

Discussion Groups

Discussion Groups | Piclist | Re: Why PIC?

A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.

Why PIC? - Trikoupis Nikolaos - Feb 26 5:56:00 2005


Hello to everyone!
I was wondering why should I use PIC? The new mobile phones for
example include tiny CPUs running at hundrents of MHz, consume very
little power and seem to be very powerfull. Something more they use
ultra small memory cards with hundrents of MBs capacitance while the
EEPROMs for example have a few Kbs.( I tried searching for a pdf
about how do these memory cards work with no results). Is it because
PICs are commercialy available while the other chips are patented
and can only be used by them. Has pic some features that are better
in technology and I don't know it? Are PICs a small step to pass to
these chips in the future?
Thank you!





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )


RE: Why PIC? - Wouter van Ooijen - Feb 26 8:52:00 2005

> I was wondering why should I use PIC? The new mobile phones for
> example include tiny CPUs running at hundrents of MHz, consume very
> little power and seem to be very powerfull.

They also have 100's of tiny little legs that require $$$ machines to
work with. And they are cheap, provided that you buy at least 10.000.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: Why PIC? - Nick Trik - Feb 26 11:09:00 2005

I don't think  package has anything to do with technology level and hardware capabilities. So, your answer is because they are available in DIP package and can be bought in low quantites? I don't believe that they(e.x. microchip) can't make a powerful microcontroller for hobbists. But why don't they?

Wouter van Ooijen <w...@voti.nl> wrote:
> I was wondering why should I use PIC? The new mobile phones for
> example include tiny CPUs running at hundrents of MHz, consume very
> little power and seem to be very powerfull.

They also have 100's of tiny little legs that require $$$ machines to
work with. And they are cheap, provided that you buy at least 10.000.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions






(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: Why PIC? - Wouter van Ooijen - Feb 26 11:20:00 2005

> I don't think package has anything to do with technology level and
hardware capabilities.

No, but the OP (you?) asked "I was wondering why should I use PIC?".
Package is a very good answer to that question.

> So, your answer is because they are available in DIP package and can
be bought in low quantites? I don't believe that they(e.x. microchip)
can't make a powerful microcontroller for hobbists. But why don't they?

I don't understand what you are asking. No-one makes hobby processors.
uChip makes cheap uC's that happen to be attractive for hobbyists. For
more powerfull chips check for instance Mircochip's dsPICs, the Ubicom
chips, or ARM chips (Atmel, Philips).

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: Why PIC? - Chris - Feb 26 11:24:00 2005

Hi,
 
Microchip is not in the market of making products for hobbyists. The fact that so many hobbyists use Microchip is a testimate to their ease of use, flexibility and power. The PIC devices are very capable and very powerful. There are a large number of onboard peripherals available and you can choose among many different programming languages. Microchip also makes a huge variety of chips so you can pick one that closely meets your needs.
 
The devices are inexpensive - many less than a dollar  - and easy to use despite the power available. A microcontroller is not meant to be a general purpose CPU. It is meant to be used for specific interfacing tasks. If you want general purpose then by all means develop for one of the  ARM processors using an embedded OS like Windows CE. It's a lot more expensive and a lot more complicated. I know - I've worked on embedded operating systems.
 
Choose the tool that is appropriate for your task.
 
As for why you should use a PIC? Here are some reasons:
1. Lots of support available from Microchip and the web.
2. Very simple learning curve compared to a full blown CPU and embedded OS.
3. Microchip provides free development tools which are VERY good.
4. PIC devices are inexpensive and PIC  programmers are cheap or even free if you build your own.
5. PIC devices are simple to interface. Some devices need power and ground. All others need power, ground, a clock source and one pin tied high.
6. PIC devices have very flexible IO pins that are easy to interface to the outside world. Often a direct connection to your external device is all you need.
7. PICs have onboard EEPROM, RAM  and program FLASH ROM. Many also have onboard peripherals like A/D converters, I2C busses, RS232 compatible serial ports, USB ports, comparators and other  cool stuff. Often a PIC solution is a ONE CHIP solution in your project. You can't do this with a general purpose CPU.
 
If you have a project that needs some "brains" and you don't want to add a large amount of cost, complexity or learning curve to your project then a PIC is the way to go.
 
Hope this helps.
Chris Levin
http://pic.rocklizard.org
 

 

From: Nick Trik [mailto:n...@yahoo.gr]
Sent: Saturday, February 26, 2005 8:10 AM
To: p...@yahoogroups.com
Subject: RE: [piclist] Why PIC?

I don't think  package has anything to do with technology level and hardware capabilities. So, your answer is because they are available in DIP package and can be bought in low quantites? I don't believe that they(e.x. microchip) can't make a powerful microcontroller for hobbists. But why don't they?

Wouter van Ooijen <w...@voti.nl> wrote:
> I was wondering why should I use PIC? The new mobile phones for
> example include tiny CPUs running at hundrents of MHz, consume very
> little power and seem to be very powerfull.

They also have 100's of tiny little legs that require $$$ machines to
work with. And they are cheap, provided that you buy at least 10.000.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions




to unsubscribe, go to http://www.yahoogroups.com and follow the instructions


Re: Why PIC?


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Why PIC? - rtstofer - Feb 26 11:30:00 2005


--- In , Nick Trik <ntricoup@y...> wrote:
> I don't think package has anything to do with technology level
and hardware capabilities. So, your answer is because they are
available in DIP package and can be bought in low quantites? I don't
believe that they(e.x. microchip) can't make a powerful
microcontroller for hobbists. But why don't they?

You can buy other types of processors - there are MANY different
types. The PIC is a microcontroller. It has very little
computational ability, it doesn't support a large memory space, but
it does have a lot of specialized hardware that is applicable to
control. PWM, A2D, CCP, I2C, Serial, etc.

The processors you wonder about for cell phones are very likely
application specific with bizarre instruction sets that are useful
for telephony only.

Intel and others make processors for PDAs that are much more general
purpose, support large memory sizes and don't necessarily have
specialized hardware. Quantity one, they aren't cheap. Here is one
with opportunistic pricing:
http://www.acroname.com/robotics/parts/R231-SP-KIT400.html

Then again, you can build any type of CPU you want with an FPGA.
Full featured CPUs with memory can be built from the Xilinx Spartan
3 Starter Board - especially the 1,000,000 gate version - for ab out
$100.

Not nearly as fast as the PIC is the Philips 80C552 which has all of
the control features of the mid range PIC but also supports a larger
memory space - 64K byte code space and 64K byte data space.

None of these will keep up with a Pentium 4 - which also doesn't
have control hardware. Smaller versions such as the miniITX stuff
could be much more useful for robotics - but they don't have control
hardware either.

So, in the end, something like a PIC will be included to control the
motors, knobs and dials. But they are microcontrollers, not general
purpose CPUs. > Wouter van Ooijen <wouter@v...> wrote:> I was wondering why should
I use PIC? The new mobile phones for
> > example include tiny CPUs running at hundrents of MHz, consume
very
> > little power and seem to be very powerfull.
>
> They also have 100's of tiny little legs that require $$$ machines
to
> work with. And they are cheap, provided that you buy at least
10.000.
>
> Wouter van Ooijen
>
> -- -------------------------------------------
> Van Ooijen Technische Informatica: www.voti.nl
> consultancy, development, PICmicro products
> docent Hogeschool van Utrecht: www.voti.nl/hvu >
>
> to unsubscribe, go to http://www.yahoogroups.com and follow the
instructions > Yahoo! Groups SponsorADVERTISEMENT > ---------------------------------
> Yahoo! Groups Links
>
> To > ---------------------------------




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Why PIC? - Mr S - Feb 26 13:48:00 2005

Sorry for the length...

Well, there are many reasons to use a PIC, and many
reasons not to, it all depends on your design goals.

If you want to learn more about mobile phones, try
going to the TI website and search their OMAP
products, because this is exactly the kind of thing
that makes new mobile phones do what they do...

Once you get there, you will find that OMAP is based
on the ARM9 or ARMx processors. And shortly after
that, if you want xx MIPS for your project, you'll
decide that you need an ARMx, XScale, or FreeScale
processor... then sadly, sometime after that, you'll
find out that if you want to do something like build a
robot, you will have to make that processor do lots of
other things and interface to many things... so you'll
want to simply send serial commands to control your
wheels and other peripheral devices...

Sadly, without the serial interfact to things like
wheels, that means sending PWM and control signals to
an H-Bridge to drive the motors, and reading shaft
encoder counts to know how fast it is turning... and
using precious I/O lines on your big processor to
simply control the direction of your wheels.

Then you will want to use a Peripheral Interface
Controller such as a low end dsPic from microchip
which has a hardware USART, includes PWM channels,
extra I/O for controlling an H-Bridge, and a
Quadrature Encoder Interface for counting shaft
encoder counts, plus memory for storing that
information... then you'll slave the clock of the
dsPIC to your ARMx processor and be able to send
serial commands to read the encoder counts on your
wheel for the last 5-10 seconds, plus recieve
interrupt requests from that dsPIC when the bumper
sensor it controls has been activated...

All of this allows your very big ARMx to be doing the
things you want it to do instead of the mundane wheel
tick counting...

Spend some time thinking about scaling your design to
use minimum resources rather than trying to get one
thoroughbred race horse to pull all the cottoncandy
carts at the fair one at a time, how about a few
smaller ponies to do that so the race horse has time
to show off what it can do.

You don't want to waste all the I/O on your ARMx for
mundane things if you don't have to, and ESPECIALLY if
you can use a couple of them to interface to a PIC CAN
transceiver so that those same lines can talk to a
dozen or more PICs that are doing the mundane work.

There are thousands of things a uC can do with only a
few MIPS that augment your big processor, examples of
this can be seen in the various uC elements in your
standard PC that do stuff so the big processor doesn't
have to. (serial ports, keyboard, harddrives, floppy
controller, powersupply, etc...)

There are also thousands of projects that need a uC
that is small, low power, and needs no OS... things
like a digital clock, speedometer, digital
thermometer, R/C car speed controller, 4 port ethernet
hub, battery charger, and on and on and on...

So the answer is not which you should use, but when
you should use which one....

Some folks have done things with a PIC like remote
camera operation to capture wildlife in action, bridge
to an ISA ethernet controller, add Internet interface
to the pan and tilt of a web cam for remote viewing
etc...

In your tool box, I'm sure there are different sized
screwdrivers, and so in your design tool box, you
should have different sized uC parts/tools.

The size of your main CPU is not the only
consideration. System resources of your final project
and how they are used is a major consideration. If
your project has small requirements, wasting a $200+
CPU to do it when a $6 PIC would suffice is just
absurd.

Hope that helps

--- Trikoupis Nikolaos <> wrote:
> I was wondering why should I use PIC? The new mobile
> phones for
> example include tiny CPUs running at hundrents of
> MHz, consume very
> little power and seem to be very powerfull.
> Something more they use
> ultra small memory cards with hundrents of MBs
> capacitance while the
> EEPROMs for example have a few Kbs.( I tried
> searching for a pdf
> about how do these memory cards work with no
> results). Is it because
> PICs are commercialy available while the other chips
> are patented
> and can only be used by them. Has pic some features
> that are better
> in technology and I don't know it? Are PICs a small
> step to pass to
> these chips in the future?
> Thank you! > to unsubscribe, go to http://www.yahoogroups.com and
> follow the instructions
> Yahoo! Groups Links __________________________________________________
">http://mail.yahoo.com





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: Why PIC? - Wouter van Ooijen - Feb 26 14:36:00 2005

Message
> If you want general purpose then by all means develop for one of the  ARM processors using an embedded OS like Windows CE. 
 
Are you sure? An Atmel or Philips ARM chip kan be bought for roughly the price of an 18F. That does not buy you windows CE, but personally I don't see why you would want that.
 

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu
 





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

RE: Why PIC? - Chris - Feb 26 19:29:00 2005

Message
I mentioned CE as it fits in the "General Purpose" category and it's expensive.
 
-Chris


From: Wouter van Ooijen [mailto:w...@voti.nl]
Sent: Saturday, February 26, 2005 11:37 AM
To: p...@yahoogroups.com
Subject: RE: [piclist] Why PIC?

> If you want general purpose then by all means develop for one of the  ARM processors using an embedded OS like Windows CE. 
 
Are you sure? An Atmel or Philips ARM chip kan be bought for roughly the price of an 18F. That does not buy you windows CE, but personally I don't see why you would want that.
 

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu
 



to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Why PIC? - rtstofer - Feb 27 13:57:00 2005



An alternative I am considering: http://www.newmicros.com/ I am not
a big fan of Forth but I do like using state machines and the IsoMax
language with a fast DSP chip is very interesting.

Look especially at the SeroPod - now this is a servo controller! It
is being used at http://www.lynxmotion.com/Category.aspx?
CategoryID=68 Check out the movies, this is an elegant bit of
motion control.

There is some very clever work being done.

--- In , "Wouter van Ooijen" <wouter@v...>
wrote:
> > If you want general purpose then by all means develop for one of
the
> ARM processors using an embedded OS like Windows CE.
>
> Are you sure? An Atmel or Philips ARM chip kan be bought for
roughly the
> price of an 18F. That does not buy you windows CE, but personally I
> don't see why you would want that. > Wouter van Ooijen
>
> -- -------------------------------------------
> Van Ooijen Technische Informatica: www.voti.nl
> consultancy, development, PICmicro products
> docent Hogeschool van Utrecht: www.voti.nl/hvu




Re: Why PIC?


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Why PIC? - Mr S - Feb 27 14:19:00 2005

Yes, the TinyARM looks pretty impressive, though I'm
not so enthuzed about forth, or third even... From
what I understand, NMI is starting to, or planning to
support C, and for me, that would make it a must look
into deal.

I'm still most impressed by the dsPIC line at the
moment. Parallel processing for robotics seems much
more workable when the uC's involved have specialized
task functionality that I don't have to buid into them
all the time.

I'm still searching for answers to "What's the best
tactic to do video analysis?" and FPGA seems to be the
winning answer at the moment. Again, I'm looking at a
solution that is multiprocessor, multitasking, and
synchronized. Does anyone out there have information
about PIC being used in a video analysis application?

I'll use PIC to control the camera platform(s)
physical motion, but that means taking the analysis
data and shuffling it out to the PIC(s) to make the
required camera position adjustments.

This little project that I'm researching seems to get
bigger by the hour....

Cheers

--- rtstofer <> wrote: >
>
> An alternative I am considering:
> http://www.newmicros.com/ I am not
> a big fan of Forth but I do like using state
> machines and the IsoMax
> language with a fast DSP chip is very interesting.
>
> Look especially at the SeroPod - now this is a servo
> controller! It
> is being used at
> http://www.lynxmotion.com/Category.aspx?
> CategoryID=68 Check out the movies, this is an
> elegant bit of
> motion control.
>
> There is some very clever work being done.
>
> --- In , "Wouter van Ooijen"
> <wouter@v...>
> wrote:
> > > If you want general purpose then by all means
> develop for one of
> the
> > ARM processors using an embedded OS like Windows
> CE.
> >
> > Are you sure? An Atmel or Philips ARM chip kan be
> bought for
> roughly the
> > price of an 18F. That does not buy you windows CE,
> but personally I
> > don't see why you would want that.
> >
> >
> > Wouter van Ooijen
> >
> > -- -------------------------------------------
> > Van Ooijen Technische Informatica: www.voti.nl
> > consultancy, development, PICmicro products
> > docent Hogeschool van Utrecht: www.voti.nl/hvu > to unsubscribe, go to http://www.yahoogroups.com and
> follow the instructions
> Yahoo! Groups Links __________________________________________________
">http://mail.yahoo.com





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Why PIC? - rtstofer - Feb 27 14:50:00 2005


--- In , Mr S <szinn_the1@y...> wrote:
> Yes, the TinyARM looks pretty impressive, though I'm
> not so enthuzed about forth, or third even... From
> what I understand, NMI is starting to, or planning to
> support C, and for me, that would make it a must look
> into deal.

I was looking at the IOSPod and ServoPod - these things are powerful!
Everything runs essentially parallel with a schedule timer of 5MHz.

What I don't know is just how large a program can get. I have seen
the example code for the hexapod and it is sizeable. And clear as
mud as most of it is written in Forth. I'll just have to keep at it
until I understand it... > I'm still most impressed by the dsPIC line at the
> moment. Parallel processing for robotics seems much
> more workable when the uC's involved have specialized
> task functionality that I don't have to buid into them
> all the time.
>
> I'm still searching for answers to "What's the best
> tactic to do video analysis?" and FPGA seems to be the
> winning answer at the moment. Again, I'm looking at a
> solution that is multiprocessor, multitasking, and
> synchronized. Does anyone out there have information
> about PIC being used in a video analysis application?

I know exactly nothing about video analysis but the CMUcam uses a
Scenix SX-52 chip to process the video and do such things as color
tracking. The thing is, this is very low resolution stuff at a
fairly low frame rate.

As I still know exactly nothing about video analysis, I couldn't
even guess what the archiecture of the machine should be. If
something like 256K of 32 bit memory and 1,000,000 gates seems
feasible, the revised Spartan 3 Starter Board
(https://www.digilentinc.com/Sales/Product.cfm?Prod=S3BOARD) is
fairly cheap. You have to go to Add To Card to get the price for
the 1M gate version (total $149).

I REALLY like FPGAs - they can be used to build just about anything! > I'll use PIC to control the camera platform(s)
> physical motion, but that means taking the analysis
> data and shuffling it out to the PIC(s) to make the
> required camera position adjustments.
>
> This little project that I'm researching seems to get
> bigger by the hour....

Yes, I have been working on a ball chasing Hummer and I am still
having problems with the color tracking. So far, I am not terribly
impressed with the CMUcam. I just need to keep hammering on it
until I get what I need. Or, I need to become proficient in video
analysis - a subject I was planning to avoid. > Cheers



Help needed badly - Substraction using PIC code


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Help needed badly - Substraction using PIC code - Devon Lee - Feb 27 14:52:00 2005

Hi there,

Would like to ask you something about the PIC program
to perform subtraction. Mind to comment about it?
Thanks in advance.

In the following, am I right to say that '00011111'
minus '00000001'? But it is 2's complement? Mind
teaching about this matter? Not very sure about it.

Does it mean that '00011111' will be converted into
'11100000' and this value will added with '1' and in
the end, I obtained '11100001'?

But then, I do not know how to continue from here,
mind teaching? Please? Hope you dont mind me asking
such direct help. Please?

-------------------------------------
MOVLW B'00000001'
SUBLW B'00011111'
BTFSS STATUS,C
BTFSC STATUS,Z
BSF PORTC,2
GOTO START
END
-------------------------------------

__________________________________





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Help needed badly - Substraction using PIC code - rtstofer - Feb 27 15:28:00 2005


--- In , Devon Lee <devonsc@y...> wrote:
> Hi there,
>
> Would like to ask you something about the PIC program
> to perform subtraction. Mind to comment about it?
> Thanks in advance.
>
> In the following, am I right to say that '00011111'
> minus '00000001'?

I don't understand this question. Both are positive binary numbers.

> But it is 2's complement? Mind
> teaching about this matter? Not very sure about it. Two's complement is used by almost every modern arithmetic logic
unit. Among other things, it eliminates the possibility of a -0
result. There are thousands of explanations on the Internet that
will be better than this - use Google:

To form the 2's complement of a number, complement the number and
add 1.

00000101 +5
11111010 complement
00000001 +1
--------
11111011 -5 as 2s complement

00001000 +8
11111011 -5
--------
00000011 +3 result of addition - ignore the carry out.

00001000 +8
11110111 complement
11111000 add 1 to get -8

00000011 +3
11111000 -8
--------
11111011 a negative result (-5)

00000100 complement
00000001 add 1
--------
00000101 +5 so the result above was really -5 as expected

> Does it mean that '00011111' will be converted into
> '11100000' and this value will added with '1' and in
> the end, I obtained '11100001'?

Yes > But then, I do not know how to continue from here,
> mind teaching? Please? Hope you dont mind me asking
> such direct help. Please?

Two's complement arithmetic is actually used inside the arithmetic
unit. The PIC, however, has SUB and SUBLW instructios so there is
no particular need to deal with the number system directly except to
understand what is going on. If those instructions had been omitted
you could do the arithmetic with ADDWF and ADDLW. > -------------------------------------
> MOVLW B'00000001'
> SUBLW B'00011111'

I don't know what you were expecting but SUBLW subtracts W
('00000001' in this case) from the literal ('00011111' in this case)
and will result in '00011110'.

This is NOT the result I would expect from SUBLW based on ADDLW but
it is what the chip does.

> BTFSS STATUS,C
> BTFSC STATUS,Z
> BSF PORTC,2
> GOTO START
> END
> ------------------------------------- >
>
> __________________________________




Re: Help needed badly - Substraction using PIC code


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Help needed badly - Substraction using PIC code - Devon Lee - Feb 27 16:07:00 2005

Thank you so so much for the detail explanation.
Thanks a lot. --- rtstofer <> wrote: > --- In , Devon Lee
> <devonsc@y...> wrote:
> > Hi there,
> >
> > Would like to ask you something about the PIC
> program
> > to perform subtraction. Mind to comment about it?
> > Thanks in advance.
> >
> > In the following, am I right to say that
> '00011111'
> > minus '00000001'?
>
> I don't understand this question. Both are positive
> binary numbers.
>
> > But it is 2's complement? Mind
> > teaching about this matter? Not very sure about
> it.
> >
>
> Two's complement is used by almost every modern
> arithmetic logic
> unit. Among other things, it eliminates the
> possibility of a -0
> result. There are thousands of explanations on the
> Internet that
> will be better than this - use Google:
>
> To form the 2's complement of a number, complement
> the number and
> add 1.
>
> 00000101 +5
> 11111010 complement
> 00000001 +1
> --------
> 11111011 -5 as 2s complement
>
> 00001000 +8
> 11111011 -5
> --------
> 00000011 +3 result of addition - ignore the carry
> out.
>
> 00001000 +8
> 11110111 complement
> 11111000 add 1 to get -8
>
> 00000011 +3
> 11111000 -8
> --------
> 11111011 a negative result (-5)
>
> 00000100 complement
> 00000001 add 1
> --------
> 00000101 +5 so the result above was really -5 as
> expected
>
> > Does it mean that '00011111' will be converted
> into
> > '11100000' and this value will added with '1' and
> in
> > the end, I obtained '11100001'?
>
> Yes
>
> >
> > But then, I do not know how to continue from here,
> > mind teaching? Please? Hope you dont mind me
> asking
> > such direct help. Please?
>
> Two's complement arithmetic is actually used inside
> the arithmetic
> unit. The PIC, however, has SUB and SUBLW
> instructios so there is
> no particular need to deal with the number system
> directly except to
> understand what is going on. If those instructions
> had been omitted
> you could do the arithmetic with ADDWF and ADDLW.
>
> >
> > -------------------------------------
> > MOVLW B'00000001'
> > SUBLW B'00011111'
>
> I don't know what you were expecting but SUBLW
> subtracts W
> ('00000001' in this case) from the literal
> ('00011111' in this case)
> and will result in '00011110'.
>
> This is NOT the result I would expect from SUBLW
> based on ADDLW but
> it is what the chip does.
>
> > BTFSS STATUS,C
> > BTFSC STATUS,Z
> > BSF PORTC,2
> > GOTO START
> > END
> > -------------------------------------
> >
> >
> >
> >
> >
> >
> >
> > __________________________________
> __________________________________





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Why PIC? - Murugan - Feb 28 1:16:00 2005

The pic microcontroller is preffered by most of the developers to easily build on prototypes and develop pre commercial release working models with minimum cost and simplicity. The other type of processors like pentium, arm,etc.. used in mobile phones may be cheap while manufactured in bulk quantities, but proves costly during development phase which requires high price develpment tools. And basically any project which works well using Pic micro will do well when ported to other micros.
 
murugan
 
----- Original Message -----
From: Wouter van Ooijen
To: p...@yahoogroups.com
Sent: Saturday, February 26, 2005 6:22 PM
Subject: RE: [piclist] Why PIC?

> I was wondering why should I use PIC? The new mobile phones for
> example include tiny CPUs running at hundrents of MHz, consume very
> little power and seem to be very powerfull.

They also have 100's of tiny little legs that require $$$ machines to
work with. And they are cheap, provided that you buy at least 10.000.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu


to unsubscribe, go to http://www.yahoogroups.com and follow the instructions



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Why PIC? - Igor Janjatovic - Feb 28 5:17:00 2005

> I was wondering why should I use PIC?

Besides multimedia devices (PDA, mobile phone, MP3 player...) everything
else is PICed :)

If you have no intention to deal with multimedia devices then PIC (or any
other similar 8-bit MCU) should be your choice.

On the other hand, if you are thinking about making some of above mentioned
multimedia devices - think again. It's cheaper to buy one and it sure saves
some time :)

Finally, if you are still interested in 200MHz processor with 16MB memory
you can start with www.arm.com You will find all the information you need
about ARM processors there including the list of all ARM processor/MCU
manufacturers. Good MCU to start with might be LPC2000 (ARM7) family from
Philips. There is excellent Yahoo group just like this one but dedicated to
LPC2000 MCUs. It's not quite 'multimedia oriented' MCU but it has great
support. For real multimedia applications you might be interested in new
LPC3000 family (ARM9) which should be available in Q2/2005. Also, you might
want to check what 'Nexperia' (from Philips) is.

Please note that if you have no previous experience with processors/MCUs you
will find dealing with ARM processors (32-bit architecture) very difficult
in the beginning. In that case, starting with PIC (or any other 8-bit
architecture) might be good idea.

Regards,
Igor
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.4.0 - Release Date: 22.02.2005.




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Help needed badly - Basic Boost Circuit - Devon Lee - Feb 28 9:09:00 2005

Hi there,

Would like to ask for you guys opinion regarding the
boost circuit which is capable of stepping up the
input voltage level to a higher level.

Chiefly, I've done testing on a very basic boost
circuit after the necessary calculation to obtain the
component values. A 680uF capacitor, 470uH inductor
and an operating frequency of 30kHz. These are the
values obtained through calculation. As attached in
the "File" is the basic boost circuit.

However, while testing the circuit with a 50% duty
cycle, I obtain the following:

V_input = 3V and V_out = 35V

Mind to give some advice on what are the matters that
I should consider checking here? I manage to turn ON
and OFF the MOSFET well. And it seems that I will only
be able to boost up to the appropriate level with a
50% duty cycle at 2200kHz from the function generator.

Help needed. Real lost.
__________________________________





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Help needed badly - Basic Boost Circuit - Leon Heller - Feb 28 9:28:00 2005

----- Original Message -----
From: "Devon Lee" <>
To: <>
Sent: Monday, February 28, 2005 1:09 PM
Subject: [piclist] Help needed badly - Basic Boost Circuit >
> Hi there,
>
> Would like to ask for you guys opinion regarding the
> boost circuit which is capable of stepping up the
> input voltage level to a higher level.
>
> Chiefly, I've done testing on a very basic boost
> circuit after the necessary calculation to obtain the
> component values. A 680uF capacitor, 470uH inductor
> and an operating frequency of 30kHz. These are the
> values obtained through calculation. As attached in
> the "File" is the basic boost circuit.
>
> However, while testing the circuit with a 50% duty
> cycle, I obtain the following:
>
> V_input = 3V and V_out = 35V
>
> Mind to give some advice on what are the matters that
> I should consider checking here? I manage to turn ON
> and OFF the MOSFET well. And it seems that I will only
> be able to boost up to the appropriate level with a
> 50% duty cycle at 2200kHz from the function generator.
>
> Help needed. Real lost.

I don't see the problem, if you are getting 35V out it seems to be working
OK. What is the load?

Leon
--
Leon Heller, G1HSM
http://www.geocities.com/leon_heller
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.1 - Release Date: 27/02/2005



Re: Help needed badly - Basic Boost Circuit


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Help needed badly - Basic Boost Circuit - Devon Lee - Feb 28 10:18:00 2005

Hi there,

Thanks for your reply. About the boost circuit, I
didn't apply any load at the output. I was thinking
that I should be getting a 5V to 6V output since my
input is 3V.

I guess I need a proper load then. Mind if I were to
ask about the load. Is there a way where I can use a
load, something like the value of a resistor to
represent my load? Advice needed.

And since my load of the circuit my vary. Does it mean
that I will not necessary get a 6V from 3V if I were
to boost up at 50% duty cycle? Does it mean that the
6V is the minimum output voltage that I will obtain?

Sorry for asking such minor and simple stuffs, really
need help here. Mind guiding? Thanks a lot in advance.
--- Leon Heller <> wrote:

> ----- Original Message -----
> From: "Devon Lee" <>
> To: <>
> Sent: Monday, February 28, 2005 1:09 PM
> Subject: [piclist] Help needed badly - Basic Boost
> Circuit > >
> > Hi there,
> >
> > Would like to ask for you guys opinion regarding
> the
> > boost circuit which is capable of stepping up the
> > input voltage level to a higher level.
> >
> > Chiefly, I've done testing on a very basic boost
> > circuit after the necessary calculation to obtain
> the
> > component values. A 680uF capacitor, 470uH
> inductor
> > and an operating frequency of 30kHz. These are the
> > values obtained through calculation. As attached
> in
> > the "File" is the basic boost circuit.
> >
> > However, while testing the circuit with a 50% duty
> > cycle, I obtain the following:
> >
> > V_input = 3V and V_out = 35V
> >
> > Mind to give some advice on what are the matters
> that
> > I should consider checking here? I manage to turn
> ON
> > and OFF the MOSFET well. And it seems that I will
> only
> > be able to boost up to the appropriate level with
> a
> > 50% duty cycle at 2200kHz from the function
> generator.
> >
> > Help needed. Real lost.
>
> I don't see the problem, if you are getting 35V out
> it seems to be working
> OK. What is the load?
>
> Leon
> --
> Leon Heller, G1HSM
> http://www.geocities.com/leon_heller >
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.300 / Virus Database: 266.5.1 - Release
> Date: 27/02/2005
__________________________________





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Help needed badly - Basic Boost Circuit - rooster_0429 - Feb 28 10:40:00 2005


Hi,

I'm an electrical engineer and I was looking at your circuit. I'm
not exactly sure what you have it in mind for but I think that maybe
you should look into using an op amp circuit. They are much easier
to design for and much easier to calibrate for a specific gain. Plus
they will work the same for a square wave as they do for a constant
voltage signal. Look at the LM741 or there is another one the LM386.
Its an audio amplifier that would be appropriate for higher current
levels. Heres a tip if you decide to go this route the best way to
get a stable gain for a small signal is to use two inverting opamp
circuits. --- In , Devon Lee <devonsc@y...> wrote:
> Hi there,
>
> Would like to ask for you guys opinion regarding the
> boost circuit which is capable of stepping up the
> input voltage level to a higher level.
>
> Chiefly, I've done testing on a very basic boost
> circuit after the necessary calculation to obtain the
> component values. A 680uF capacitor, 470uH inductor
> and an operating frequency of 30kHz. These are the
> values obtained through calculation. As attached in
> the "File" is the basic boost circuit.
>
> However, while testing the circuit with a 50% duty
> cycle, I obtain the following:
>
> V_input = 3V and V_out = 35V
>
> Mind to give some advice on what are the matters that
> I should consider checking here? I manage to turn ON
> and OFF the MOSFET well. And it seems that I will only
> be able to boost up to the appropriate level with a
> 50% duty cycle at 2200kHz from the function generator.
>
> Help needed. Real lost. >
> __________________________________





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Minor Question On PIC Code - Paul James E. - Mar 1 7:17:00 2005


Devon,

No, not in this case because decimal 2 (2) and hex 2 (0x02) are the same
value. But if for instance you put decimal 20 (20) when you meant hex 20
(0x20), or vice versa, there would be a problem. A problem because decimal
20 means 20. However hex 20 means 32 decimal. ie 16 x 2 = 32.
Hope this helps you out. Regards,

Jim > Hi there,
>
> Would likw to ask some minor stuffs about PIC
> programming. Sorry, slow learner here. Thanks in
> advance.
>
> Regarding=>
>
> BSF STATUS,RP0
> MOVLW B'00100000'
> MOVWF PR2
> BCF TRISC,0x02 ;Line A
> BCF STATUS,RP0
>
> And=>
>
> BSF STATUS,RP0
> MOVLW B'00100000'
> MOVWF PR2
> BCF TRISC,2 ;Line B
> BCF STATUS,RP0
>
> Does line A and B make a difference? Real sorry if
> this is a dumb question. >
> __________________________________ > to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions Yahoo! Groups Links





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Minor Question On PIC Code - Devon Lee - Mar 1 19:04:00 2005

Hi there,

Would likw to ask some minor stuffs about PIC
programming. Sorry, slow learner here. Thanks in
advance.

Regarding=>

BSF STATUS,RP0
MOVLW B'00100000'
MOVWF PR2
BCF TRISC,0x02 ;Line A
BCF STATUS,RP0

And=>

BSF STATUS,RP0
MOVLW B'00100000'
MOVWF PR2
BCF TRISC,2 ;Line B
BCF STATUS,RP0

Does line A and B make a difference? Real sorry if
this is a dumb question.
__________________________________




Re: Minor Question On PIC Code


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Another Minor Question On PIC Code - Devon Lee - Mar 1 19:26:00 2005

Hi Jim,

Thanks a lot for your explanation.

Would like to ask about something regarding PIC Code
again. Hope you guys dont mind.

I intend to use 2 ADC input pin, thus, I set up as
shown in the following:

However, I couldnt get the program to run as in it
doesnt go any further after it reaches Line A (as
shown in the following), where it keeps on looping in
"Check2". I've done this checking using the MPSIM, by
the way. Is there anything that I've missed out where
I should add-on? Advice really needed. Thanks in
advance. ****************************************************
;INITIALIZE ADC

START:
BSF STATUS,RP0
MOVLW B'10001001'
MOVWF ADCON1
BCF STATUS,RP0

AC:
MOVLW B'01000001' ;INTEND TO USE AN0
MOVWF ADCON0
BSF ADCON0,GO_DONE

CHECK1:
BTFSC ADCON0,GO_DONE
GOTO CHECK1
MOVF ADRESH,W
MOVWF RESULTHIGH1
BSF STATUS,RP0
MOVF ADRESL,W
BCF STATUS,RP0
MOVWF RESULTLOW1
RETURN

PANEL:
MOVLW B'01000010' ;INTEND TO USE AN1
MOVWF ADCON0
BSF ADCON0,GO_DONE

CHECK2:
BTFSC ADCON0,GO_DONE
GOTO CHECK2 ;LINE A,DOESNT PROCEED
MOVF ADRESH,W
MOVWF RESULTHIGH2
BSF STATUS,RP0
MOVF ADRESL,W
BCF STATUS,RP0
MOVWF RESULTLOW2
RETURN

__________________________________




Re: Another Minor Question On PIC Code
Re: Another Minor Question On PIC Code
Re: Another Minor Question On PIC Code
Re: Another Minor Question On PIC Code


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Another Minor Question On PIC Code - Eirik Karlsen - Mar 1 20:01:00 2005

How did you plan on getting to
PANEL or CHECK2 ?
there are no branches to take the execution over there...
 

Devon Lee wrote:

Hi Jim,

Thanks a lot for your explanation.

Would like to ask about something regarding PIC Code
again. Hope you guys dont mind.

I intend to use 2 ADC input pin, thus, I set up as
shown in the following:

However, I couldnt get the program to run as in it
doesnt go any further after it reaches Line A (as
shown in the following), where it keeps on looping in
"Check2". I've done this checking using the MPSIM, by
the way. Is there anything that I've missed out where
I should add-on? Advice really needed. Thanks in
advance.
 

****************************************************
;INITIALIZE ADC

START:
      BSF      STATUS,RP0
      MOVLW      B'10001001'
      MOVWF      ADCON1
      BCF      STATUS,RP0

AC:
      MOVLW      B'01000001'      ;INTEND TO USE AN0
      MOVWF      ADCON0
      BSF      ADCON0,GO_DONE

CHECK1:
      BTFSC      ADCON0,GO_DONE
      GOTO       CHECK1
      MOVF      ADRESH,W
      MOVWF      RESULTHIGH1
      BSF      STATUS,RP0
      MOVF      ADRESL,W
      BCF      STATUS,RP0
      MOVWF       RESULTLOW1
      RETURN

PANEL:
      MOVLW      B'01000010'      ;INTEND TO USE AN1
      MOVWF      ADCON0
      BSF      ADCON0,GO_DONE

CHECK2:
      BTFSC      ADCON0,GO_DONE
      GOTO       CHECK2           ;LINE A,DOESNT PROCEED
      MOVF      ADRESH,W
      MOVWF      RESULTHIGH2
      BSF      STATUS,RP0
      MOVF      ADRESL,W
      BCF      STATUS,RP0
      MOVWF       RESULTLOW2
      RETURN
 
 
 

__________________________________

 

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen
 

Attachment (not stored)
C:\DOCUME~1\ek\LOKALE~1\Temp\nsmail8H.gif
Type: image/gif

Attachment (not stored)
C:\DOCUME~1\ek\LOKALE~1\Temp\nsmailRP.gif
Type: image/gif



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Another Minor Question On PIC Code - Eirik Karlsen - Mar 1 20:04:00 2005

However if as you say you got in there and it keeps looping this can only be because
the ADC is already DONE (you have not restarted it) or the DAC is disabled by some
other means.
 

Eirik Karlsen wrote:

How did you plan on getting to
PANEL or CHECK2 ?
there are no branches to take the execution over there...
 

Devon Lee wrote:

Hi Jim,

Thanks a lot for your explanation.

Would like to ask about something regarding PIC Code
again. Hope you guys dont mind.

I intend to use 2 ADC input pin, thus, I set up as
shown in the following:

However, I couldnt get the program to run as in it
doesnt go any further after it reaches Line A (as
shown in the following), where it keeps on looping in
"Check2". I've done this checking using the MPSIM, by
the way. Is there anything that I've missed out where
I should add-on? Advice really needed. Thanks in
advance.
 

****************************************************
;INITIALIZE ADC

START:
      BSF      STATUS,RP0
      MOVLW      B'10001001'
      MOVWF      ADCON1
      BCF      STATUS,RP0

AC:
      MOVLW      B'01000001'      ;INTEND TO USE AN0
      MOVWF      ADCON0
      BSF      ADCON0,GO_DONE

CHECK1:
      BTFSC      ADCON0,GO_DONE
      GOTO       CHECK1
      MOVF      ADRESH,W
      MOVWF      RESULTHIGH1
      BSF      STATUS,RP0
      MOVF      ADRESL,W
      BCF      STATUS,RP0
      MOVWF       RESULTLOW1
      RETURN

PANEL:
      MOVLW      B'01000010'      ;INTEND TO USE AN1
      MOVWF      ADCON0
      BSF      ADCON0,GO_DONE

CHECK2:
      BTFSC      ADCON0,GO_DONE
      GOTO       CHECK2           ;LINE A,DOESNT PROCEED
      MOVF      ADRESH,W
      MOVWF      RESULTHIGH2
      BSF      STATUS,RP0
      MOVF      ADRESL,W
      BCF      STATUS,RP0
      MOVWF       RESULTLOW2
      RETURN
 
 
 

__________________________________

 
 
 

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen
 

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen
 



(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Another Minor Question On PIC Code - Eirik Karlsen - Mar 1 20:06:00 2005

Uh...
disregard that one (its getting a bit late...)

Eirik Karlsen wrote:

> However if as you say you got in there and it keeps looping this can only be because
> the ADC is already DONE (you have not restarted it) or the DAC is disabled by some
> other means. > Eirik Karlsen wrote:
>
> > How did you plan on getting to
> > PANEL or CHECK2 ?
> > there are no branches to take the execution over there...
> >
> >
> > Devon Lee wrote:
> >
> >> Hi Jim,
> >>
> >> Thanks a lot for your explanation.
> >>
> >> Would like to ask about something regarding PIC Code
> >> again. Hope you guys dont mind.
> >>
> >> I intend to use 2 ADC input pin, thus, I set up as
> >> shown in the following:
> >>
> >> However, I couldnt get the program to run as in it
> >> doesnt go any further after it reaches Line A (as
> >> shown in the following), where it keeps on looping in
> >> "Check2". I've done this checking using the MPSIM, by
> >> the way. Is there anything that I've missed out where
> >> I should add-on? Advice really needed. Thanks in
> >> advance.
> >>
> >>
> >> ****************************************************
> >> ;INITIALIZE ADC
> >>
> >> START:
> >> BSF STATUS,RP0
> >> MOVLW B'10001001'
> >> MOVWF ADCON1
> >> BCF STATUS,RP0
> >>
> >> AC:
> >> MOVLW B'01000001' ;INTEND TO USE AN0
> >> MOVWF ADCON0
> >> BSF ADCON0,GO_DONE
> >>
> >> CHECK1:
> >> BTFSC ADCON0,GO_DONE
> >> GOTO CHECK1
> >> MOVF ADRESH,W
> >> MOVWF RESULTHIGH1
> >> BSF STATUS,RP0
> >> MOVF ADRESL,W
> >> BCF STATUS,RP0
> >> MOVWF RESULTLOW1
> >> RETURN
> >>
> >> PANEL:
> >> MOVLW B'01000010' ;INTEND TO USE AN1
> >> MOVWF ADCON0
> >> BSF ADCON0,GO_DONE
> >>
> >> CHECK2:
> >> BTFSC ADCON0,GO_DONE
> >> GOTO CHECK2 ;LINE A,DOESNT PROCEED
> >> MOVF ADRESH,W
> >> MOVWF RESULTHIGH2
> >> BSF STATUS,RP0
> >> MOVF ADRESL,W
> >> BCF STATUS,RP0
> >> MOVWF RESULTLOW2
> >> RETURN
> >>
> >>
> >>
> >>
> >> __________________________________
> >>
> >>
> >> to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
> >>
> >>
> >>
> >
> > --
> > *******************************************
> > VISIT MY HOME PAGE:
> > <http://home.online.no/~eikarlse/index.htm>
> > LAST UPDATED: 23/08/2003
> > *******************************************
> > Regards
> > Eirik Karlsen
> >
>
> --
> *******************************************
> VISIT MY HOME PAGE:
> <http://home.online.no/~eikarlse/index.htm>
> LAST UPDATED: 23/08/2003
> *******************************************
> Regards
> Eirik Karlsen > to unsubscribe, go to http://www.yahoogroups.com and follow the instructions
>
> Yahoo! Groups Sponsor
> ADVERTISEMENT
> [click here] > 
> Yahoo! Groups Links
>
> * To

--
*******************************************
VISIT MY HOME PAGE:
<http://home.online.no/~eikarlse/index.htm>
LAST UPDATED: 23/08/2003
*******************************************
Regards
Eirik Karlsen



Re: Another Minor Question On PIC Code


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Another Minor Question On PIC Code - Devon Lee - Mar 1 20:18:00 2005

Oh no...mind guiding me, please? But I've tried to
initialize everything again by putting the
initialization code for the ADCON1 before I proceed to
the "PANEL" portion. And yet, it still loops again and
again at the "CHECK2". Mind giving me some advice?
Please? > Eirik Karlsen wrote:
>
> > However if as you say you got in there and it
> keeps looping this can only be because
> > the ADC is already DONE (you have not restarted
> it) or the DAC is disabled by some
> > other means.
> >
> >
> > Eirik Karlsen wrote:
> >
> > > How did you plan on getting to
> > > PANEL or CHECK2 ?
> > > there are no branches to take the execution over
> there...
> > >
> > >
> > > Devon Lee wrote:
> > >
> > >> Hi Jim,
> > >>
> > >> Thanks a lot for your explanation.
> > >>
> > >> Would like to ask about something regarding PIC
> Code
> > >> again. Hope you guys dont mind.
> > >>
> > >> I intend to use 2 ADC input pin, thus, I set up
> as
> > >> shown in the following:
> > >>
> > >> However, I couldnt get the program to run as in
> it
> > >> doesnt go any further after it reaches Line A
> (as
> > >> shown in the following), where it keeps on
> looping in
> > >> "Check2". I've done this checking using the
> MPSIM, by
> > >> the way. Is there anything that I've missed out
> where
> > >> I should add-on? Advice really needed. Thanks
> in
> > >> advance.
> > >>
> > >>
> > >>
> ****************************************************
> > >> ;INITIALIZE ADC
> > >>
> > >> START:
> > >> BSF STATUS,RP0
> > >> MOVLW B'10001001'
> > >> MOVWF ADCON1
> > >> BCF STATUS,RP0
> > >>
> > >> AC:
> > >> MOVLW B'01000001' ;INTEND TO
> USE AN0
> > >> MOVWF ADCON0
> > >> BSF ADCON0,GO_DONE
> > >>
> > >> CHECK1:
> > >> BTFSC ADCON0,GO_DONE
> > >> GOTO CHECK1
> > >> MOVF ADRESH,W
> > >> MOVWF RESULTHIGH1
> > >> BSF STATUS,RP0
> > >> MOVF ADRESL,W
> > >> BCF STATUS,RP0
> > >> MOVWF RESULTLOW1
> > >> RETURN
> > >>
> > >> PANEL:
> > >> MOVLW B'01000010' ;INTEND TO
> USE AN1
> > >> MOVWF ADCON0
> > >> BSF ADCON0,GO_DONE
> > >>
> > >> CHECK2:
> > >> BTFSC ADCON0,GO_DONE
> > >> GOTO CHECK2 ;LINE
> A,DOESNT PROCEED
> > >> MOVF ADRESH,W
> > >> MOVWF RESULTHIGH2
> > >> BSF STATUS,RP0
> > >> MOVF ADRESL,W
> > >> BCF STATUS,RP0
> > >> MOVWF RESULTLOW2
> > >> RETURN
> > >>
> > >>
> > >>
> > >>
> > >> __________________________________
> > >>
> > >>
> > >>
> > >> to unsubscribe, go to
> http://www.yahoogroups.com and follow the
> instructions
> > >>
> > >>
> > >>
> > >
> > > --
> > > *******************************************
> > > VISIT MY HOME PAGE:
> > > <http://home.online.no/~eikarlse/index.htm>
> > > LAST UPDATED: 23/08/2003
> > > *******************************************
> > > Regards
> > > Eirik Karlsen
> > >
> >
> > --
> > *******************************************
> > VISIT MY HOME PAGE:
> > <http://home.online.no/~eikarlse/index.htm>
> > LAST UPDATED: 23/08/2003
> > *******************************************
> > Regards
> > Eirik Karlsen
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com
> and follow the instructions
> >
> > Yahoo! Groups Sponsor
> > ADVERTISEMENT
> > [click here]
> >
> >
> > 
> > Yahoo! Groups Links
> >
> > * To
>
> --
> *******************************************
> VISIT MY HOME PAGE:
> <http://home.online.no/~eikarlse/index.htm>
> LAST UPDATED: 23/08/2003
> *******************************************
> Regards
> Eirik Karlsen

__________________________________





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Again, Another Minor Question On PIC Code - Paul James E. - Mar 1 23:15:00 2005


Devon,

This will not change them from their power up values. All port pins
power up as inputs. Writing a '1' to an TRIS register makes that pin
an input. To make a pin an output, you have to write a '0' for that
pin to the tris register. Also not that PORTA is not a full 8 bits wide.
I believe on this part PORTA is 6 bits wide. The 2 MSB's will read as '0'.
Change your B'11111111' to B'00000000' and all should work as you intend.
At least the Port will. Regards,

Jim
>
> Hi there,
>
> I tried simulating this portion of the code, I'm using
> PIC 16F876. > BSF STATUS,RP0
> MOVLW B'11111111'
> MOVWF TRISA
> BCF STATUS,RP0 > To enable the Port A to function as an output port.
> However, through the simulation (MPSIM), the values in
> TRISA register does not change to '11111111'. Mind to
> comment about this? Please? Thanks in advance. I've
> checked the bank and it seems that TRISA is in Bank1.
>
> Mind helping? Please? I tried doing the same thing to
> TRISB and TRISC and it works. Meaning, I'm able to
>store the desired value into TRISB and TRISC. >
>
> __________________________________
> Celebrate Yahoo!'s 10th Birthday!
> Yahoo! Netrospective: 100 Moments of the Web
> http://birthday.yahoo.com/netrospective/ > to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions Yahoo! Groups Links





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Another Minor Question On PIC Code - john - Mar 2 1:13:00 2005


It looks like you typed in the value wrong.
You have the ADC module turned off in the panel function.
Your assigning B'01000010' to ADCON0 in panel
but in AC you assign B'01000001' to ADCON0. bit zero needs to be
set to turn on the adc.

--- In , Devon Lee <devonsc@y...> wrote:
> Hi Jim,
>
> Thanks a lot for your explanation.
>
> Would like to ask about something regarding PIC Code
> again. Hope you guys dont mind.
>
> I intend to use 2 ADC input pin, thus, I set up as
> shown in the following:
>
> However, I couldnt get the program to run as in it
> doesnt go any further after it reaches Line A (as
> shown in the following), where it keeps on looping in
> "Check2". I've done this checking using the MPSIM, by
> the way. Is there anything that I've missed out where
> I should add-on? Advice really needed. Thanks in
> advance. > ****************************************************
> ;INITIALIZE ADC
>
> START:
> BSF STATUS,RP0
> MOVLW B'10001001'
> MOVWF ADCON1
> BCF STATUS,RP0
>
> AC:
> MOVLW B'01000001' ;INTEND TO USE AN0
> MOVWF ADCON0
> BSF ADCON0,GO_DONE
>
> CHECK1:
> BTFSC ADCON0,GO_DONE
> GOTO CHECK1
> MOVF ADRESH,W
> MOVWF RESULTHIGH1
> BSF STATUS,RP0
> MOVF ADRESL,W
> BCF STATUS,RP0
> MOVWF RESULTLOW1
> RETURN
>
> PANEL:
> MOVLW B'01000010' ;INTEND TO USE AN1
> MOVWF ADCON0
> BSF ADCON0,GO_DONE
>
> CHECK2:
> BTFSC ADCON0,GO_DONE
> GOTO CHECK2 ;LINE A,DOESNT PROCEED
> MOVF ADRESH,W
> MOVWF RESULTHIGH2
> BSF STATUS,RP0
> MOVF ADRESL,W
> BCF STATUS,RP0
> MOVWF RESULTLOW2
> RETURN >
>
> __________________________________





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Another Minor Question On PIC Code - Devon Lee - Mar 2 4:07:00 2005

Hi John,

Thank you so so much, John. Thanks for correcting me.
I refer to the datasheet to check again and it seems
that I've mistaken and thought by writing B'01000010'
means selecting AN1, which is not. Thanks a lot! --- john <> wrote: > It looks like you typed in the value wrong.
> You have the ADC module turned off in the panel
> function.
> Your assigning B'01000010' to ADCON0 in panel
> but in AC you assign B'01000001' to ADCON0. bit zero
> needs to be
> set to turn on the adc.
>
> --- In , Devon Lee
> <devonsc@y...> wrote:
> > Hi Jim,
> >
> > Thanks a lot for your explanation.
> >
> > Would like to ask about something regarding PIC
> Code
> > again. Hope you guys dont mind.
> >
> > I intend to use 2 ADC input pin, thus, I set up as
> > shown in the following:
> >
> > However, I couldnt get the program to run as in it
> > doesnt go any further after it reaches Line A (as
> > shown in the following), where it keeps on looping
> in
> > "Check2". I've done this checking using the MPSIM,
> by
> > the way. Is there anything that I've missed out
> where
> > I should add-on? Advice really needed. Thanks in
> > advance.
> >
> >
> >
> ****************************************************
> > ;INITIALIZE ADC
> >
> > START:
> > BSF STATUS,RP0
> > MOVLW B'10001001'
> > MOVWF ADCON1
> > BCF STATUS,RP0
> >
> > AC:
> > MOVLW B'01000001' ;INTEND TO USE AN0
> > MOVWF ADCON0
> > BSF ADCON0,GO_DONE
> >
> > CHECK1:
> > BTFSC ADCON0,GO_DONE
> > GOTO CHECK1
> > MOVF ADRESH,W
> > MOVWF RESULTHIGH1
> > BSF STATUS,RP0
> > MOVF ADRESL,W
> > BCF STATUS,RP0
> > MOVWF RESULTLOW1
> > RETURN
> >
> > PANEL:
> > MOVLW B'01000010' ;INTEND TO USE AN1
> > MOVWF ADCON0
> > BSF ADCON0,GO_DONE
> >
> > CHECK2:
> > BTFSC ADCON0,GO_DONE
> > GOTO CHECK2 ;LINE A,DOESNT PROCEED
> > MOVF ADRESH,W
> > MOVWF RESULTHIGH2
> > BSF STATUS,RP0
> > MOVF ADRESL,W
> > BCF STATUS,RP0
> > MOVWF RESULTLOW2
> > RETURN
> >
> >
> >
> >
> > __________________________________
>
__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Again, Another Minor Question On PIC Code - Devon Lee - Mar 2 10:33:00 2005

Hi there,

I tried simulating this portion of the code, I'm using
PIC 16F876. BSF STATUS,RP0
MOVLW B'11111111'
MOVWF TRISA
BCF STATUS,RP0 To enable the Port A to function as an output port.
However, through the simulation (MPSIM), the values in
TRISA register does not change to '11111111'. Mind to
comment about this? Please? Thanks in advance. I've
checked the bank and it seems that TRISA is in Bank1.

Mind helping? Please? I tried doing the same thing to
TRISB and TRISC and it works. Meaning, I'm able to
store the desired value into TRISB and TRISC.

__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/




Re: Again, Another Minor Question On PIC Code


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Again, Another Minor Question On PIC Code - Devon Lee - Mar 2 11:40:00 2005

Hi there,

Thanks a lot, Jim. I got it. Sorry for not reading up
well enough. Thanks again. --- "Paul James E." <> wrote: > Devon,
>
> This will not change them from their power up
> values. All port pins
> power up as inputs. Writing a '1' to an TRIS
> register makes that pin
> an input. To make a pin an output, you have to
> write a '0' for that
> pin to the tris register. Also not that PORTA is
> not a full 8 bits wide.
> I believe on this part PORTA is 6 bits wide. The 2
> MSB's will read as '0'.
> Change your B'11111111' to B'00000000' and all
> should work as you intend.
> At least the Port will. >
> Regards, > Jim >
> >
> > Hi there,
> >
> > I tried simulating this portion of the code, I'm
> using
> > PIC 16F876.
> >
> >
> > BSF STATUS,RP0
> > MOVLW B'11111111'
> > MOVWF TRISA
> > BCF STATUS,RP0
> >
> >
> > To enable the Port A to function as an output
> port.
> > However, through the simulation (MPSIM), the
> values in
> > TRISA register does not change to '11111111'. Mind
> to
> > comment about this? Please? Thanks in advance.
> I've
> > checked the bank and it seems that TRISA is in
> Bank1.
> >
> > Mind helping? Please? I tried doing the same thing
> to
> > TRISB and TRISC and it works. Meaning, I'm able to
> >store the desired value into TRISB and TRISC.
> >
> >
> >
> >
> > __________________________________
> > Celebrate Yahoo!'s 10th Birthday!
> > Yahoo! Netrospective: 100 Moments of the Web
> > http://birthday.yahoo.com/netrospective/
> >
> >
> > to unsubscribe, go to http://www.yahoogroups.com
> and follow the
> > instructions Yahoo! Groups Links
> >
> >
> >
> __________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Again, Another Minor Question On PIC Code - Igor Janjatovic - Mar 2 12:37:00 2005

> I tried simulating this portion of the code, I'm using
> PIC 16F876.

You might have trouble with ADC module. PORTA pins are by default analog
inputs. Read data sheet section which explains ADC module and you'll see
that first you need to configure PORTA pins as digital pins (not analog) and
then you can set TRISA register.

Let me know if it works.

Regards,
Igor
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.4 - Release Date: 01.03.2005.




(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Again Help Needed, Another Minor Question On PIC Code - Devon Lee - Mar 3 14:37:00 2005

Hi there,

Guess I've asked this before but hope you guys dont
mind guiding me again. I still dont get the ADC code
run well. Did I miss out any of the comments given by
you guys?

It seems that the ADC code turn ON all the LEDs and
they remain ON at all times, no matter what voltage is
being applied to the analogue input.

Mind to comment about it? Help needed. Thanks in
advance.

PIC Code=>

LIST P=16F876
#INCLUDE "P16F876.INC"
__CONFIG _CP_OFF & _XT_OSC & _WDT_OFF & _PWRTE_ON &
_LVP_OFF & _BODEN_ON
ERRORLEVEL -306, -302

;MAIN PROGRAM 1 - BOOST

ORG 0X00
GOTO START

RESULTHIGH1 EQU 24H
RESULTLOW1 EQU 25H
RESULTHIGH2 EQU 26H
RESULTLOW2 EQU 27H

;**************************************************************************
;TEST ADC READINGS

START:
BSF STATUS,RP0
MOVLW B'00000000'
MOVWF TRISC
BCF STATUS,RP0

;**************************************************************************
;INITIALIZATION FOR ADC1 AND ADC2 (PORT A)
;ADC1 IS FOR FEEDBACK FROM BATTERY
;ADC2 IS FOR FEEDBACK FROM SOLAR PANEL

BSF STATUS,RP0
MOVLW B'10001001'
MOVWF ADCON1
BCF STATUS,RP0

;**************************************************************************
;START CHECK

RESTART:
CALL ADC1 ;FEEDBACK FROM BATTERY
BTFSC RESULTLOW1,0
BSF PORTC,0
BTFSC RESULTLOW1,1
BSF PORTC,1
BTFSC RESULTLOW1,2
BSF PORTC,2
BTFSC RESULTLOW1,3
BSF PORTC,3
BTFSC RESULTLOW1,4
BSF PORTC,4
BTFSC RESULTLOW1,5
BSF PORTC,5
BTFSC RESULTLOW1,6
BSF PORTC,6
BTFSC RESULTLOW1,7
BSF PORTC,7
GOTO RESTART

;**************************************************************************
;READ BATTERY VOLTAGE LEVEL (AN0)

ADC1:
MOVLW B'01000001'
MOVWF ADCON0
BSF ADCON0,GO_DONE

CHECK1:
BTFSC ADCON0,GO_DONE
GOTO CHECK1
MOVF ADRESH,W
MOVWF RESULTHIGH1
BSF STATUS,RP0
MOVF ADRESL,W
BCF STATUS,RP0
MOVWF RESULTLOW1
RETURN
END __________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/




Re: Again Help Needed, Another Minor Question On PIC Code
Re: Again Help Needed, Another Minor Question On PIC Code


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Again Help Needed, Another Minor Question On PIC Code - john - Mar 3 15:13:00 2005


You need to clear the Port Bits. Once the bits get set they will
stay that way unless you add code to clear the port bit when the bit
in RESULTLOW1 is zero.

--- In , Devon Lee <devonsc@y...> wrote:
> Hi there,
>
> Guess I've asked this before but hope you guys dont
> mind guiding me again. I still dont get the ADC code
> run well. Did I miss out any of the comments given by
> you guys?
>
> It seems that the ADC code turn ON all the LEDs and
> they remain ON at all times, no matter what voltage is
> being applied to the analogue input.
>
> Mind to comment about it? Help needed. Thanks in
> advance.
>
> PIC Code=>
>
> LIST P=16F876
> #INCLUDE "P16F876.INC"
> __CONFIG _CP_OFF & _XT_OSC & _WDT_OFF & _PWRTE_ON &
> _LVP_OFF & _BODEN_ON
> ERRORLEVEL -306, -302
>
> ;MAIN PROGRAM 1 - BOOST
>
> ORG 0X00
> GOTO START
>
> RESULTHIGH1 EQU 24H
> RESULTLOW1 EQU 25H
> RESULTHIGH2 EQU 26H
> RESULTLOW2 EQU 27H
>
> ;******************************************************************
********
> ;TEST ADC READINGS
>
> START:
> BSF STATUS,RP0
> MOVLW B'00000000'
> MOVWF TRISC
> BCF STATUS,RP0
>
> ;******************************************************************
********
> ;INITIALIZATION FOR ADC1 AND ADC2 (PORT A)
> ;ADC1 IS FOR FEEDBACK FROM BATTERY
> ;ADC2 IS FOR FEEDBACK FROM SOLAR PANEL
>
> BSF STATUS,RP0
> MOVLW B'10001001'
> MOVWF ADCON1
> BCF STATUS,RP0
>
> ;******************************************************************
********
> ;START CHECK
>
> RESTART:
> CALL ADC1 ;FEEDBACK FROM BATTERY
> BTFSC RESULTLOW1,0
> BSF PORTC,0
> BTFSC RESULTLOW1,1
> BSF PORTC,1
> BTFSC RESULTLOW1,2
> BSF PORTC,2
> BTFSC RESULTLOW1,3
> BSF PORTC,3
> BTFSC RESULTLOW1,4
> BSF PORTC,4
> BTFSC RESULTLOW1,5
> BSF PORTC,5
> BTFSC RESULTLOW1,6
> BSF PORTC,6
> BTFSC RESULTLOW1,7
> BSF PORTC,7
> GOTO RESTART
>
> ;******************************************************************
********
> ;READ BATTERY VOLTAGE LEVEL (AN0)
>
> ADC1:
> MOVLW B'01000001'
> MOVWF ADCON0
> BSF ADCON0,GO_DONE
>
> CHECK1:
> BTFSC ADCON0,GO_DONE
> GOTO CHECK1
> MOVF ADRESH,W
> MOVWF RESULTHIGH1
> BSF STATUS,RP0
> MOVF ADRESL,W
> BCF STATUS,RP0
> MOVWF RESULTLOW1
> RETURN
> END > __________________________________
> Celebrate Yahoo!'s 10th Birthday!
> Yahoo! Netrospective: 100 Moments of the Web
> http://birthday.yahoo.com/netrospective/




Re: Again Help Needed, Another Minor Question On PIC Code


(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Re: Again Help Needed, Another Minor Question On PIC Code - Devon Lee - Mar 3 15:17:00 2005

Hi there,

Thanks a lot. Mind if I were to ask if....if there is
anything else that I should consider changing? Just to
ask in advance so I can try them out in the lab later.

Sorry for asking such minor problems. Thanks a lot in
advance.

So, are the following changes alright? Hope you dont
mind me posting the code again =>

LIST P=16F876
#INCLUDE "P16F876.INC"
__CONFIG _CP_OFF & _XT_OSC & _WDT_OFF & _PWRTE_ON &
_LVP_OFF & _BODEN_ON
ERRORLEVEL -306, -302

;MAIN PROGRAM 1 - BOOST

ORG 0X00
GOTO START

RESULTHIGH1 EQU 24H
RESULTLOW1 EQU 25H
RESULTHIGH2 EQU 26H
RESULTLOW2 EQU 27H

;**************************************************************************
;TEST ADC READINGS

START:
BSF STATUS,RP0
MOVLW B'11111111'
MOVWF TRISA
MOVLW B'00000000'
MOVWF TRISC
BCF STATUS,RP0

;**************************************************************************
;INITIALIZATION FOR ADC1 AND ADC2 (PORT A)
;ADC1 IS FOR FEEDBACK FROM BATTERY
;ADC2 IS FOR FEEDBACK FROM SOLAR PANEL

BSF STATUS,RP0
MOVLW B'10001001'
MOVWF ADCON1
BCF STATUS,RP0

;**************************************************************************
;START CHECK

RESTART:
CLRF RESULTLOW1
CALL ADC1 ;FEEDBACK FROM BATTERY
MOVF RESULTLOW1,W
MOVWF PORTC
GOTO RESTART

;**************************************************************************
;READ BATTERY VOLTAGE LEVEL (AN0)

ADC1:
MOVLW B'01000001'
MOVWF ADCON0
BSF ADCON0,GO_DONE

CHECK1:
BTFSC ADCON0,GO_DONE
GOTO CHECK1
MOVF ADRESH,W
MOVWF RESULTHIGH1
BSF STATUS,RP0
MOVF ADRESL,W
BCF STATUS,RP0
MOVWF RESULTLOW1
RETURN
END
__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo! Netrospective: 100 Moments of the Web
http://birthday.yahoo.com/netrospective/





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Again Help Needed, Another Minor Question On PIC Code - rtstofer - Mar 3 15:23:00 2005


--- In , Devon Lee <devonsc@y...> wrote:
> Hi there,
>
> Guess I've asked this before but hope you guys dont
> mind guiding me again. I still dont get the ADC code
> run well. Did I miss out any of the comments given by
> you guys?
>
> It seems that the ADC code turn ON all the LEDs and
> they remain ON at all times, no matter what voltage is
> being applied to the analogue input.
>
> Mind to comment about it? Help needed. Thanks in
> advance.
>
> PIC Code=>
>
> LIST P=16F876
> #INCLUDE "P16F876.INC"
> __CONFIG _CP_OFF & _XT_OSC & _WDT_OFF & _PWRTE_ON &
> _LVP_OFF & _BODEN_ON
> ERRORLEVEL -306, -302
>
> ;MAIN PROGRAM 1 - BOOST
>
> ORG 0X00
> GOTO START
>
> RESULTHIGH1 EQU 24H
> RESULTLOW1 EQU 25H
> RESULTHIGH2 EQU 26H
> RESULTLOW2 EQU 27H
>
> ;******************************************************************
********
> ;TEST ADC READINGS
>
> START:
> BSF STATUS,RP0
> MOVLW B'00000000'
> MOVWF TRISC You just set all the pins to OUTPUT - this means the A/D will read
them as DIGITAL inputs, not ANALOG.

Everything you need to know about the A2D is in chapter 23 of the
MidRangeMPU manual available at www.microchip.com including the
initialization code in section 23.13. The example doesn't show the
requirement that the pins be INPUT - that is shown in 23.6

Or, download App Note 546 "Using The Analog To Digital Converter"
and the related source code.

> BCF STATUS,RP0
>
> ;******************************************************************
********
> ;INITIALIZATION FOR ADC1 AND ADC2 (PORT A)
> ;ADC1 IS FOR FEEDBACK FROM BATTERY
> ;ADC2 IS FOR FEEDBACK FROM SOLAR PANEL
>
> BSF STATUS,RP0
> MOVLW B'10001001'
> MOVWF ADCON1
> BCF STATUS,RP0
>
> ;******************************************************************
********
> ;START CHECK
>
> RESTART:
> CALL ADC1 ;FEEDBACK FROM BATTERY
> BTFSC RESULTLOW1,0
> BSF PORTC,0
> BTFSC RESULTLOW1,1
> BSF PORTC,1
> BTFSC RESULTLOW1,2
> BSF PORTC,2
> BTFSC RESULTLOW1,3
> BSF PORTC,3
> BTFSC RESULTLOW1,4
> BSF PORTC,4
> BTFSC RESULTLOW1,5
> BSF PORTC,5
> BTFSC RESULTLOW1,6
> BSF PORTC,6
> BTFSC RESULTLOW1,7
> BSF PORTC,7
> GOTO RESTART
>
> ;******************************************************************
********
> ;READ BATTERY VOLTAGE LEVEL (AN0)
>
> ADC1:
> MOVLW B'01000001'
> MOVWF ADCON0
> BSF ADCON0,GO_DONE
>
> CHECK1:
> BTFSC ADCON0,GO_DONE
> GOTO CHECK1
> MOVF ADRESH,W
> MOVWF RESULTHIGH1
> BSF STATUS,RP0
> MOVF ADRESL,W
> BCF STATUS,RP0
> MOVWF RESULTLOW1
> RETURN
> END > __________________________________
> Celebrate Yahoo!'s 10th Birthday!
> Yahoo! Netrospective: 100 Moments of the Web
> http://birthday.yahoo.com/netrospective/





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Re: Once Again Help Needed, Another Minor Question On PIC Code - Paul James E. - Mar 4 1:20:00 2005


Devon,

My 2 cents worth is as follows....

1. Make sure the period you are trying to time is commensurate with the
timer you intend to use. ie with no prescaler TMR0 is ~256uS at 4 Mhz.

2. Bone up on interrupts as you'll no doubt want to use them in
conjunction with the timer timouts. You could poll the timer, but
interrupts are better and less likely to be missed, and definitely
more repeatable.

3. Make sure you address ALL the registers associated with your timer of
choice. Just so you cover all the options and choose the options you
want.

4. Once you get a timer working like you want it to, experiment with some
of the other options to see if you can make it work better, easier,
faster, etc. if you have the time. This could conceivably improve
the operation of your software or system. At a mininum it will
facilitate your learning more about the part that if not used on this
project, could be used on the next.

5. In conjunction with all the above, keep good notes and records. That
way when a problem comes up, you can check your notes and records to
see if you have had and/or solved it before. And if so, how.
It saves you from reinventing the wheel. Hope this is what you wanted to hear. Regards, and Good Luck,

Jim

P.S. Let us know how you make out in your endeavors. >
> Hi there,
>
> Thanks to everyone. Thank you so so much. Would like
> to ask if you guys mind to give me some ideas on what
> are the considerations that I first need to look into
> while using the internal Timer (not sure which Timer
> is it call yet) of a PIC 16F876 to run a timer?
>
> In the meantime, I will search for the application
> notes from the Microchip website. By the way, the
> application note on the ADC from Microchip was really
> good.
>
> Thanks again. Hope you guys dont mind guiding me.
> Thanks in advance. >
>
> __________________________________
> Celebrate Yahoo!'s 10th Birthday!
> Yahoo! Netrospective: 100 Moments of the Web
> http://birthday.yahoo.com/netrospective/ > to unsubscribe, go to http://www.yahoogroups.com and follow the
> instructions Yahoo! Groups Links





(You need to be a member of piclist -- send a blank email to piclist-subscribe@yahoogroups.com )

Once Again Help Needed, Another Minor Question On PIC Code - Devon Lee - Mar 4 10:59:00 2005

Hi there,

Thanks to everyone. Thank you so so much. Would like
to ask if you guys mind to give me some ideas on what
are the considerations that I first need to look into
while using the internal Timer (not sure which Timer
is it call yet) of a PIC 16F876 to run a timer?

In the meantime, I will search for the application
notes from the Microchip website. By the way, the
application note on the ADC from Microchip was really
good.

Thanks again. Hope you guys dont mind guiding me.
Thanks in advance.

__________________________________
Celebrate Yahoo!'s 10th Birthday!
Yahoo!