PDA

View Full Version : Assembly?



Dwayne
- 28th December 2003, 05:59
Hello Folks,

Name here is Dwayne, I used to program the Philips 750 and 752 chips. I used assembly.

I have decided to try these PIC chips, and have orderd the programmer (Serial). Now I have a couple of questions.

1. Is there a free assembly programmer for the PIC?


2. How can I be sure when I progam the 675, that I will be using only the EEProm, and not ruin the rest of the chip, to where I cannot program on it anymore? if so, what is the HEX address I must ORG to?

Dwayne

Desterline
- 28th December 2003, 07:49
1. Is there a free assembly programmer for the PIC?

Microchip supplies MpLab, free download. Start at www.microchip.com


2. How can I be sure when I progam the 675, that I will be using only the EEProm, and not ruin the rest of the chip, to where I cannot program on it anymore? if so, what is the HEX address I must ORG to?

Hmmm, If I knew more about the Philips chips you mentioned this question might make more sense to me.

Best I can say is you're not understanding the nature of a PIC chip. Modern PICs such as (I asume) the 16F675 your working with have FLASH memory for program storage, EEPROM for constants and data and the like, and a small amount of RAM for the variables. All of this is good for thousands of write cycles, you can't "ruin" a PIC by programming it. And you can't put "program" code in the EEPROM. (well, technicaly you could, but there's no way for the PIC to run code stored in the EEPROM, so it'd be pointless anyway.)

There is a code protect bit that will prevent you reading the code you just programmed, but you can still do a "bulk erase" and program the chip again.


One other note, this forum is oriented towards using a BASIC compiler for programming. Assembly programming might be better supported at other sites. (www.piclist.com comes to mind)

But we'd be happy to have you get a compiler and join us, :-)

-Denny

Dwayne
- 29th December 2003, 21:46
Hello Denny,

Denny >>Best I can say is you're not understanding the nature of a PIC chip. Modern PICs such as (I asume) the 16F675 your working with have FLASH memory for program storage, EEPROM for constants and data and the like, and a small amount of RAM for the variables. <<

I am working with the 12F675. And I do not want to use that crazy UV eraser <g> Like I had to use with the Philips 750 and 752.

I am extremely new to the PIC series of chips. My knowledge is zelch on these chips.

I would like to program these chips on the fly, and be able to reprogram them on the fly. Without having to purchase chips again and again. The UV only lasted about 25 times or so on the philips, and I had to sit under that UV for 30 min, and sometimes 45 min.(towards the end).


Denny>>All of this is good for thousands of write cycles, you can't "ruin" a PIC by programming it. <<

Good, I was hoping it wasn't a OTP chip, and presto...you are out of luck.

Denny>>And you can't put "program" code in the EEPROM. (well, technicaly you could, but there's no way for the PIC to run code stored in the EEPROM, so it'd be pointless anyway.)<<

I read that the 12f675 and 1k of Eprom 126 byes of EEprom, and a small amount of RAM. this puzzled me, because this told me that the 1k of Eprom is programmable, but has to be erased by a UV... or something else. Could you set me straight on this please?

I have looked over kingdom come, and MPASM doesn't exist. there is a MPASM IDE, but that is not a assembler. I guess I may have to fork out 300 dollars for the basic language... Which I am not sure I like that or not. Relying upon this tells me I cannot streamline my code the way I want.

Dwayne

Desterline
- 29th December 2003, 22:10
Well, for starters the "F" in the part number stands for "Flash", as in flash memory, not EPROM.

I've only used the 12F675 once, (my perfered chip is the 16F877A, for the bootloader capability- self programs through a serial port), but I have the datasheet here and it says:

PIC12F675 1024(words) flash, 64(bytes) SRAM, and 128 (bytes) EEPROM.

And while were here, note the endurance is spec'd at 100K cycles for the FLASH and 1M cycles for the EEPROM.

Mpasm is part of MpLab, it also includes an IDE, a simulator and lots of other tools I don't like or use. :-)
Here's a direct link: http://www.microchip.com/1010/pline/tools/picmicro/devenv/mplabi/index.htm

BTW, I've programmed PICs in assembler, C (from CCS), and PBP. I wouldn't even think about giving up my basic compiler. PBP and microCode Studio were the best investments I made in my PIC toolbox. I recently designed a simple device, read one ADC channel, three buttons and three LEDs, data out a serial port and on an LCD, total time 2.5 hours. I could have spent 8-10 with C, or days with assembler.

If you do decide to buy PBP, talk to some of there distributers, some of them can put together a package deal where you get a better price than strait from MELabs.

-Denny

Dwayne
- 30th December 2003, 04:08
Hello Denny,

Denny>>If you do decide to buy PBP, talk to some of there distributers, some of them can put together a package deal where you get a better price than strait from MELabs.<<

Unfortunately I already bought the programmer... The cheapest I saw the software for (If I remember correctly) was 299 dollars? I will have to check again. That I believe is the ProBasic.

Is this the main compiler you recommend using?

Dwayne

Desterline
- 30th December 2003, 06:34
>>Is this the main compiler you recommend using?

Well, it was the first available compiler. And as such it probably has the largest user base, and it folows that you would get the best third party support. (things like this forum)

Recently I've heard good things about Proton+, but I've not used it myself.

I don't consider myself well experianced in everything that's available, I know what I have and I like it.

Be aware though, PBP is just a DOS command line program. MEL supplies an editor (actualy they call it an IDE) called Code Designer Lite (IIRC)

My preference is micoCode Studio from Mechanique. It's about $45, but it's worth it for me. For you though... Two of the main features is a built in bootloader and a serial ICD (in circuit debugger) the 12F parts can't self program, so a bootloader is out of the question. And the serial ICD requires a hardware UART, the 12F doesn't have one. With those limitations it's hard to justify the money, if all you're programming is 12F parts.

I'm wondering, why the 12F675. Usualy the entry point into PICs is the 18 pin 16F84 (which is now supersceded by three generations, pin compatible though) or the much larger (40-pin) 16F877. (better in my book because of the bootloader capabilities) Many are now reccomending begginers start with the 18F series.

If you do decide to buy PBP, talk to Randy Jones at www.glitchbuster.com. I bought mine from him, and in the end I got a better deal than I've seen published *anywhere*.

Have you read the PBP manual? I'm not sure what you want ot do with PICs, but there are some limitations on what can be done in PBP on the 12F series chips, not sure if it would affect you though.


Hmmm... re-reading your post, you mentioned ProBasic. Just to complicate our lifes, several compiler makers have very similar sounding names. Specificaly I use the one from here: http://www.melabs.com/products/pbp.htm
You can read the documentation and examples on line, they even have a limited demo version you can download. (limited to 31 BASIC instructions, that's pleanty to see the kind of things it can do.)

-Denny

Dwayne
- 2nd January 2004, 17:07
Dr>>Is this the main compiler you recommend using?

Denny>>Well, it was the first available compiler. And as such it probably has the largest user base, and it folows that you would get the best third party support. (things like this forum)<<

The Cheapest I found it is 299.00 Plus shipping.

Denny>>
I'm wondering, why the 12F675. Usualy the entry point into PICs is the 18 pin 16F84 (which is now supersceded by three generations, pin compatible though) or the much larger (40-pin) 16F877. (better in my book because of the bootloader capabilities) Many are now reccomending begginers start with the 18F series.<<

Well, the project I am doing, only requires a delay counter. Nothing more.

Example.

Psuedo Code:



When chip is started

immediately take pin1a and ground it. (This activates the battery backup) .

Loop:

Begin Delay for 5 to 7 min.
ground another pin1b.
Delay for 1/2 second.
unground same pin1b.
Delay for 1 min
Unground first pin1a (this cancels battery backup).

****if power is still active do the following 4 lines ****
counter++;
if(counter==3)unground pin2a
delay 1 min.
Goto Loop;
*******************************************
If chip loses power, start at beginning of loop.


This is the entire routine... Plane, simple, and extremely easy. I can do it in Philips, but I can't do it in PIC. I am not familiar with the PICS, and my Philips assembly does not work on it (I found out just now). so I need to have some sample assembly code that I can relate to. How to address the pins of a PIC.

If you notice, I am only using a VCC, VSS, and 2 pins. Nothing more.

I want the cheapest chip possible to do the job. I think we both hve to admit a 16 pin Woochie is a overkill <g>

Now you know why I am using a 12f675. I use 2 out of 6 pins available... (And of course the VCC and VSS).

Denny >>If you do decide to buy PBP, talk to Randy Jones at www.glitchbuster.com. I bought mine from him, and in the end I got a better deal than I've seen published *anywhere*.<<

I attempted to access this site, and it is a private site. I do not have security to enter this site. I thought about purchasing PBP.

Thank you very much for your help, time and patience.

Dwayne

Desterline
- 2nd January 2004, 19:10
You're right, that is quite simple.

I'd expect to be able to compile that with the demo version of PBP (free download).

Lots of examples included with the download and in the archives of this group.

Feel free to ask questions.

-Denny

Dwayne
- 3rd January 2004, 07:00
Hello Denny,

My last project 8 years ago was a DDY for the deaf. I used a Philips 752 EPROM with 2K ...Powered a LCD, keyboard, and did all the BUADO code. What I did, was use a Voltage regulator to make a A/C wave pusating DC. And made a counter to count the time the DC was on. That time would be either a set amount of time, or 3 times (for a dash). After the end of the character I subbed to a table, got the charactor, and printed it out on the LCD. To transmit was easier....just go to the same table and you only toggled a pin up and down for X amount of time.

Dwayne

Dwayne
- 4th January 2004, 04:18
Hello Denny,

In the Philips, we controlled the pins as
P0.1=0 or P0.1=1;


I am guessing RA3 on the 675 and RA4 are similar.

How do you ground and unground these pins? or check their status. I found that Basic Pro compiler on the interenet.. It is allowing 900 bytes, which is plenty for what I need it for.

I am wanting to see if RA3 is grounded or not (the switch) and I want to control the grounding and ungrounding of RA4.

What is the basic command for this?

RA3=1 and RA3=0?

if RA3=0 then RA3=1;

Thanks

Dwayne

Desterline
- 4th January 2004, 06:36
I'm confused.

>>I found that Basic Pro compiler on the interenet.. It is allowing 900 bytes,

The PBP demo, available from http://www.melabs.com/pbpdemo.htm , is limitted to 31 instructions. What's the 900 bytes all about?

While looking up the demo address, I noticed a list of supported chips with the demo version, sorry to say it does not include the 12f675. Sorry to have (unintentionaly) misled you.

For simple digital control the output registers are mapped to the variable GPIO. Individual pins can be accessed with the syntax GPIO.n example:

High GPIO.0
Low GPIO.1
Toggle GPIO.2

Inputs can be read directly into a variable, suposing MyVar is a byte variable:

MyVar = GPIO.3

You can also work with the values directly

If GPIO.2 = 0 then
>do somthing<
end if

I reccomend you spend a few minutes in the archive at http://list.picbasic.com/cgi-bin/board-search.cgi a quick search of "12f675" returns ~60 different threads, many of which would be relevant to you.


-Denny

Dwayne
- 4th January 2004, 19:18
Hello Denny,

Denny>>I found that Basic Pro compiler on the interenet.. It is allowing 900 bytes,

<g>. The place I found the compiler is

http://compilespot.com


Denny>>http://www.melabs.com/pbpdemo.htm , is limitted to 31 instructions. What's the 900 bytes all about?<<

Didn't find this one <g> but found the Comspot.com.

Denny >>While looking up the demo address, I noticed a list of supported chips with the demo version, sorry to say it does not include the 12f675. Sorry to have (unintentionaly) misled you.<<

No problem. When you use a older chip that no one else uses, one (that means me especially <g>) tends to forget that the newer compilers tend to not support them.


For simple digital control the output registers are mapped to the variable GPIO. Individual pins can be accessed with the syntax GPIO.n example:

thank you for the examples. I really appreciate your time and trouble. I will check out the URL you gave me. too.

Dwayne