Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Code for 12F675 is compat with 12F683?

Status
Not open for further replies.

Tarsil

New Member
Can I use code sections from a 12F675 program directly to a 12F683?
Any experience with that? Any educated guess?
 
Assuming the code is not dealing with specific hardware, peripherals, ports etc, I see no reason why not. Any hardware related stuff may or may not need modification to fit your needs.
 
assuming you are talking about source code, for the most part. however, there are some differences - CMCON vs CMCON0 and CMCON1, OSCCAL vs OSCTUNE and OSCCON. You will need to look at those carefully.
 
I just want to use some code for working with the values from the ADC imputs...well I'l try:D
Whould be interesting to know in general thought...there are quite a few 12F675 projects.
 
Most of the times I have the source code. I'l be careful about those and I'l experiment a bit.Th.
 
The adc part is using the same sort of instructions generally, but the hardware, i.e port address, data registers etc are not always in the same place within the register memory, or indeed the control ports. Also, the number of control bits used will vary from PIC to PIC depending on the number of channels, vref etc etc, so you will need to look at the actual PIC peripheral control to make sure they are the same on both PIC's, if not then you will need to take into account the differences and ammend your code accordingly.
 
I did a side-by-side comparison and the SFRs that are in common are in the same locations. but then no one should be using addresses for them instead of names.

you really should compare the two datasheets
 
I agree, it makes much more sense, not to mention makes reading the code later far easier to understand. But there are those new to programming, that always go down the road of using the SFR addresses etc despite being advised not to.
 
I've printed out the 2 datasheets. I'l chek them out when i'l have enought time. Th for the feedbak.
 
Your hardware initialization will be slightly different and while the '675 INTOSC is "locked in" at 4-MHz, the '683 INTOSC is adjustable up to 8-MHz.

BTW, the 12F683 is a good choice.

Kind regards, Mike

Code:
;******************************************************************
;*                                                                *
;*  12F675                                                        *
;*                                                                *
;******************************************************************

        #include <p12f675.inc>
        errorlevel -302

        __config _MCLRE_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT

RESET   clrf    STATUS          ;                                 |B0
        movlw   b'00000111'     ;                                 |B0
        movwf   CMCON           ; comparator off > digital I/O    |B0
        bsf     STATUS,RP0      ; bank 1                          |B1
        call    h'3FF'          ; get factory calibration value   |B1
        movwf   OSCCAL          ; set OSCCAL calibration value    |B1
        clrf    ANSEL           ; set all pins to digital mode    |B1
Code:
;******************************************************************
;*                                                                *
;*  12F683                                                        *
;*                                                                *
;******************************************************************

        __config _FCMEN_OFF & _IESO_OFF & _MCLRE_OFF & _WDT_OFF & _INTOSCIO
;
;  12F683 specific peripheral initialization
;
Reset   clrf    STATUS          ;                                 |B0
        movlw   b'00000111'     ;                                 |B0
        movwf   CMCON0          ; comparator off                  |B0
        bsf     STATUS,RP0      ; bank 1                          |B1
        clrf    ANSEL           ; digital I/O                     |B1
;
;  setup INTOSC for 8-MHz and wait for it to become stable
;
        movlw   b'01110000'     ;                                 |B1
        movwf   OSCCON          ; 8-mhz INTOSC system clock       |B1
Stable  btfss   OSCCON,HTS      ; oscillator stable?              |B1
        goto    Stable          ; no, branch                      |B1
        bcf     STATUS,RP0      ; bank 0                          |B0
 
Mike said:
Your hardware initialization will be slightly different and while the '675 INTOSC is "locked in" at 4-MHz, the '683 INTOSC is adjustable up to 8-MHz.

BTW, the 12F683 is a good choice.

Kind regards, Mike
[/code]
Th a lot Mike! I also think that 12F683 is a nice litle beast:D all thought I bhougt it cause I didn't found any 12F675's :lol
 
I think here we have (with-12F675&683) the same paradox like the 16F84&16F628. '683 is better but there are a lot of proj for 675.
 
This thread got me interested. I just checked the specs for the 683. It has a 32K mode without a crystal that only draws 25 ua at 3v. For only 25 cents more, less than a crystal and caps, I'm switching from the 12f629 to the 683!
I don't need the precision of the crystal, just the low current draw.
 
jimg,

The 'nanowatt' capability is noteworthy. It really is their nicest 8 pin device and I hope you get an opportunity to play with it.

I've got a couple different interrupt driven half-duplex and full-duplex bit-banged 9600 baud serial I/O packages with RX and TX circular buffers, if you're interested.

Have fun. Regards, Mike

rs232-parasitic-power-2-jpg.7960
 
jimg said:
This thread got me interested. I just checked the specs for the 683. It has a 32K mode without a crystal that only draws 25 ua at 3v. For only 25 cents more, less than a crystal and caps, I'm switching from the 12f629 to the 683!
I don't need the precision of the crystal, just the low current draw.
Duhh!......just kiding :lol
 
jimg said:
?? No, I was serious. Am I mis-reading the specs here?
Sorry ...I was mean for no reason. U aren't mis-reading the specs. I just thought that the Nanowatt isn't that important compaired to other improvements over the 12F629 (now I think I might be wrong). It has higher speed int osc, 2X FLASH, RAM, EEPROM, 4X10bits AD imputs, PWM etc. a lot of things that 12F629 doesn't have.
Pls don't feel ofended...I just had a bad day:D
 
Well, my order for some 12F683's finally came in. After playing around a bit, I find out on page 126 of DS41211C that the low power internal 31K osc mode varies from 15 to 45 khz, about 50%. Uncalibrated I could handle, but I expected something a little more stable. Or am I just totally misreading the specs again? Do you think one would keep a particular setting over it's lifetime, or drift with time?
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top