Searching \ for '[PIC] 16f648A sample code?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=16F
Search entire site for: '16f648A sample code?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC] 16f648A sample code?'
2005\09\11@022224 by Carlos A. Marcano V.

picon face
Hi folks.

  Does anybody know of a link to get some 16F648A working code? I mean
real projects or learning code but not the kind of source code found in
datasheets where you only get pieces and not the whole stuff including
initialization and other things. Ah, by the way, it should be assembler
code! Thanks in advance for your valuable advice and time,

Regards,

*Carlos Marcano*
-Guri, Venezuela-

2005\09\11@023956 by Carlos A. Marcano V.

picon face
Hi folks.

 Does anybody know of a link to get some 16F648A working code? I mean
real projects or learning code but not the kind of source code found in
datasheets where you only get pieces and not the whole stuff including
initialization and other things. Ah, by the way, it should be assembler
code! Thanks in advance for your valuable advice and time,

Regards,

*Carlos Marcano*
-Guri, Venezuela-



2005\09\11@034243 by cdb

flavicon
face
I've some code, though it is written in basic.

What do you mean by initialisation ?

Do you mean the config flags (including MCLR as an input or as a
reset, or internal clock versus external) or actual setting of port
directions?  The latter is no different to the other pics.

Colin

--
cdb, spam_OUTcolinTakeThisOuTspambtech-online.co.uk on 11/09/2005

Web presence: http://www.btech-online.co.uk  

Hosted by:  http://www.1and1.co.uk/?k_id=7988359

We cannot become what we need to be by remaining what we are. (Max de
Pree)



2005\09\11@040749 by PicDude

flavicon
face
You should be able to take any 16F628 code off the net or elsewhere and make
just a few changes.

Cheers,
-Neil.


On Sunday 11 September 2005 01:40 am, Carlos A. Marcano V. scribbled:
{Quote hidden}

2005\09\11@070028 by John J. McDonough

flavicon
face
----- Original Message -----
From: "PicDude" <.....picdude2KILLspamspam@spam@narwani.org>
Subject: Re: [PIC] 16f648A sample code?


> You should be able to take any 16F628 code off the net or elsewhere and
> make
> just a few changes.

The only gotcha is that the 648A has enough memory you need to worry about
paging.

But that does point to somethig worth mentioning to Carlos ... all the
various 16F's are incredibly similar.  And while you specifically mention
initialization, the initialization code is as much dependent on your
application as it is on the particular part.  Basically, you initialize
every peripheral you intend to use, and if a pin can be used for analog, you
need to initialize it.

That last rule is the one that gets a lot of newbies to the 628/628A/648A.
The comparator input pins can't be used as digital until you configure the
CMCON register.  On other parts, the register might be CMCON0 CMCON1 or for
parts with analog inputs, ANSEL.

Once you get to doing anything at all, you need some initialization, but it
depends on your app.  With the exception of the weird analog rule, it is
pretty simple business to read the datasheet to figure out what you need.
The analog thing is sort of a gotcha since it refers to a peripheral you
don't intend to use.  I suppose if everyone memorized the datasheets it
wouldn't be an issue, but we're not all Wouter.

--McD

2005\09\11@071227 by Jan-Erik Soderholm

face picon face
John J. McDonough wrote :

>  With the exception of the weird analog rule...

In what way "weird" ?

I find it pretty logical, an analog input pin is what
will make less "harm", no matter what is connected
there. *If* it's a analog source, a *digital* input pin
would have been less good...

It's logical, but *very* easy to miss... :-)

Jan-Erik.



2005\09\11@072708 by John J. McDonough

flavicon
face
----- Original Message -----
From: "Jan-Erik Soderholm" <jan-erik.soderholmspamKILLspamtelia.com>
Subject: RE: [PIC] 16f648A sample code?


>>  With the exception of the weird analog rule...
>
> In what way "weird" ?

Well, it does make sense, but only after you have a pretty good
understanding.  When you are starting out, it seems to be totally random.

--McD

2005\09\11@093109 by olin piclist
face picon face
Carlos A. Marcano V. wrote:
>    Does anybody know of a link to get some 16F648A working code? I
> mean real projects or learning code but not the kind of source code
> found in datasheets where you only get pieces and not the whole stuff
> including initialization and other things. Ah, by the way, it should
> be assembler code!

My EasyProg PIC programmer uses a 18F648A for the controller.  It's complete
source code is available and you can rebuild it on your machine.  Go to
http://www.embedinc.com/products and follow the cookie crumbs.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

2005\09\11@102143 by olin piclist

face picon face
John J. McDonough wrote:
> With the exception of the weird analog
> rule, it is pretty simple business to read the datasheet to figure
> out what you need. The analog thing is sort of a gotcha since it
> refers to a peripheral you don't intend to use.  I suppose if
> everyone memorized the datasheets it wouldn't be an issue, but we're
> not all Wouter.

Those who aren't Wouter should then consider my standard initialization
module QQQ_PORT.ASPIC at http://www.embedinc.com/pic.  It initializes any
analog peripherals to off, then sets up the digital I/O lines according to
the /INBIT and /OUTBIT preprocessor directives in the project include file.
If you follow the discipline, it is very easy to move code between different
chips of the same core, and not too hard to move between the 16F and 18F
cores either.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

2005\09\11@102213 by Carlos A. Marcano V.

picon face
Thank you all for your answers!

  I haven´t played for a while with PIC´s and I happen to have a Wisp628 (wich I bought last year, assambled but have not ever used!) and a few 16LF648A. I know it is a low voltage version of the 16F648A. I just wanted to have a known working "blink-a-led" program (and assembler source code) to test my hardware and to "refresh" my mind. The part that is getting me confused is the /MCLR pin and the possible gotchas when programming the PIC. Thank you all for your time!

Regards,
*Carlos Marcano*
-Guri, Venezuela-

2005\09\11@103352 by Jan-Erik Soderholm

face picon face
Carlos A. Marcano V. wrote :

> I happen to have a Wisp628 ... and a few 16LF648A.
> I just wanted to have a known working "blink-a-led" program...

The blink-a-LED for program for 628A on Wouter's page works...

> (and assembler source code)...

...but you'll get JAL code. :-)

Jan-Erik.



2005\09\11@163451 by Carlos A. Marcano V.

picon face
Thank you all for your answers!

 I haven´t played for a while with PIC´s and I happen to have a Wisp628 (wich I bought last year, I assambled it but have not ever used!) and a few 16LF648A. I know it is a low voltage version of the 16F648A. I just wanted to have a known working "blink-a-led" program (and assembler source code) to test my hardware and to "refresh" my mind. The part that is getting me confused is the /MCLR pin and the possible gotchas when programming the PIC. Thank you all for your time!

Regards,
*Carlos Marcano*
-Guri, Venezuela-

2005\09\11@185644 by PicDude

flavicon
face
part 1 1280 bytes content-type:text/plain; (decoded quoted-printable)

I know what it is like when you are starting something new and have all these factors/parameters/variables that you want to minimize/eliminate.  If all you want is a sanity-check, I went ahead and created this quick little code snippet, which I built and verified on a 16F627A.  It works and flashes LEDs (at different rates on different pins of port B).  From here, you need to make just 2 changes -- where it says 627a, change it to 648A.  There is no reason that it should not work.  File attached...

Cheers,
-Neil.



On Sunday 11 September 2005 03:35 pm, Carlos A. Marcano V. scribbled:
{Quote hidden}


part 2 1885 bytes content-type:text/plain;
(decoded quoted-printable)

;---------------------------------------------------------------------


;  P627A-TEST:        Quick port toggler to see if the F627A programs and works.


;


;---------------------------------------------------------------------


;


;        TODO:


;


;       OPTIONS:


;               - Buzzer pulses on alarm, instead of steady


;               - Implement button-clicks.


;


;


;---------------------------------------------------------------------








       LIST P=16F627a


       INCLUDE "p16f627a.inc"


       ERRORLEVEL -302                ; Block bank-selection warnings.


       __CONFIG _PWRTE_ON & _INTOSC_OSC_NOCLKOUT & _MCLRE_ON & _WDT_OFF & _LVP_OFF





       CBLOCK        H'20'


          TMPREG1                ; General working space


          COUNTER                ; Counter that is sent to output port


       ENDC








       ORG        0x00


       goto        Init











;---------------------------------------------------------------------


;  Initialization section...


;---------------------------------------------------------------------





Init:


       clrf        INTCON                ; All interrupts off





       bsf        STATUS,RP0        ; Select bank 1


       bcf        STATUS,RP1        ; ...





       movlw        B'00000000'


       movwf        TRISA                ; AN0,1,RA4 are inputs, AN2,3=Vref-/+, rest o/ps


       movwf        TRISB                ; RB0-7 are outputs





       movlw        B'10001111'


       movwf        OPTION_REG





       bcf        STATUS,RP0        ; Select bank 0...


       bcf        STATUS,RP1        ; ...





       clrf        PORTA                ; Clear port A


       clrf        PORTB                ; Clear port B





       clrf        COUNTER


InitDone:








;---------------------------------------------------------------------


;  Main Code Loop


;---------------------------------------------------------------------





MainLoop:


       incf        COUNTER,F


       movf        COUNTER,W


       movwf        PORTB





Delay:


       movlw        D'255'


       movwf        TMPREG1


DLoop1:


       nop


       decfsz        TMPREG1,F


       goto        DLoop1


DelayDone:








MainLoopDone:


       goto        MainLoop











       end







part 3 35 bytes content-type:text/plain; charset="us-ascii"
(decoded 7bit)

2005\09\11@190920 by Carlos A. Marcano V.

picon face
Neil, Thanks a lot!

I will give a try tomorrow after I finished some "pay work"!

Regards,

*Carlos Marcano*
-Guri, Venezuela-

PicDude escribió:

{Quote hidden}

>

2005\09\16@013152 by Carlos A. Marcano V.

picon face
Hi, Neil.

 This just for saying thanks, the code works fine!

Regards,

*Carlos Marcano*
-Guri, Venezuela-

PicDude wrote:

{Quote hidden}

More... (looser matching)
- Last day of these posts
- In 2005 , 2006 only
- Today
- New search...