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.

Why this is not working ?

Status
Not open for further replies.

sahu

Member
Why this is not working with 16f676 ? this code work 16f684 , that's i check on Proteus
Code:
/*
* Programmer: Shivendra Kr. Sahu
  * Target PIC: PIC16F676 or PIC16F684
* use like this FOR 70 VM
  --www-- -----ADC
*  5*4.7k  |
  >
  >1.8k
  |
*/
#include <htc.h>
//#include<pic16f676.h>
//__CONFIG (FOSC_INTRCIO & MCLRE_ON & BOREN_ON & CP_ON & CPD_OFF & WDTE_OFF & PWRTE_OFF );// For 16F676 - comment for 16F684
#include<pic16f684.h>
__CONFIG (FOSC_INTOSCIO & MCLRE_ON & BOREN_ON & CP_ON & CPD_OFF & WDTE_OFF & PWRTE_OFF );// For 16F684 - comment for 16F676
#define _XTAL_FREQ 4000000

void main(void) {
  char samplecounter;
  initialize();
  while (1){
  voltage = getVoltage();
  for (samplecounter = 0; samplecounter < 80; samplecounter++){
  displayVoltage();
  }
  }
}
for 16f676 as
#include<pic16f676.h>
__CONFIG (FOSC_INTRCIO & MCLRE_ON & BOREN_ON & CP_ON & CPD_OFF & WDTE_OFF & PWRTE_OFF );// For 16F676 - comment for 16F684
CMCON = 7; // For 16F676 - comment for 16F684
Memory Summary for 16f676
Program space used 359h ( 857) of 400h words ( 83.7%)
Data space used 40h ( 64) of 40h bytes (100.0%)
EEPROM space used 0h ( 0) of 80h bytes ( 0.0%)
Configuration bits used 1h ( 1) of 1h word (100.0%)
ID Location space used 0h ( 0) of 4h bytes ( 0.0%)
for 16f684
#include<pic16f684.h>
__CONFIG (FOSC_INTOSCIO & MCLRE_ON & BOREN_ON & CP_ON & CPD_OFF & WDTE_OFF & PWRTE_OFF );// For 16F684 - comment for 16F676
CMCON0 = 7; // For 16F684 - comment for 16F676
Memory Summary 16f684
Program space used 355h ( 853) of 800h words ( 41.7%)
Data space used 40h ( 64) of 80h bytes ( 50.0%)
EEPROM space used 0h ( 0) of 100h bytes ( 0.0%)
Configuration bits used 1h ( 1) of 1h word (100.0%)
ID Location space used 0h ( 0) of 4h bytes ( 0.0%)
 
Last edited:
its means when Data space reached up to 100.0% ,then mcu can't run .
No!.... I have compiled it and it runs just fine.... BUT!!! I use XC8 pro not lite.... It won't compile in lite mode...
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top