CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

transfer code 16f877 to 12f675

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jrgob



Joined: 21 Jan 2010
Posts: 10
Location: Brazil

View user's profile Send private message Send e-mail

transfer code 16f877 to 12f675
PostPosted: Thu Jan 21, 2010 5:18 am     Reply with quote

Hello!
First sorry for my English, but I have a doubt about a code that use the PIC 16F877A and need to transfer a 12F675. The code is very simple, but the problem I think is in any configuration of 12F675. Below is the code that works in the 16F877A and the code that I moved into the 12F675.
Code:

#include <16f877.h>                               
#use delay (clock=10000000)                       
#include <cuscostdio.h>                           
#fuses HS, NOWDT, PROTECT

void main(void){
  int16 count = 0;                                 
  int16 x = 0;
  output_a(0x00);                                 
  output_b(0x00);                                 
  output_c(0x00);                                 
  output_d(0x00);                                 

  while(1){       
    count = read_eeprom(20);                       
    while(count<4){                             
      delay_ms(1000);                             
      output_high(pin_c3);
      delay_ms(1000);                             
      delay_ms(1000);                             
      output_low(pin_c3);
      count++;                                     
      write_eeprom(20,count);                     
    }
    x = read_eeprom(20);                           
    if(x>=4){                                   
      output_high(pin_e2);                         
      if (pulso(D1)){                      // function pulse()       
         write_eeprom(20,0);                           
      }
    }
    delay_ms(10);                                 
  }
}


Code:

#include <12F675.h>                                               
#rom     0x2007={0x14C}                                           
#use     delay(clock=4000000,restart_wdt)
#define  D1                            ra4
#define  led_red                     ra1                       
#define  buzzer                       ra2 
#rom     0x2114={0B00000001}                                         
#rom     0x2115={0B00000100}                                         
#rom     0x2116={0B00000001}                                       

  int16 count = 0;                                 
  int16 x = 0;

   void main(void){
      config_ini();
                                                 
       while(1){
          restart_wdt();
          count = read_eeprom(20);                     
          while(count<4){                             
              delay_msv(1000);                             
              output_high(led_red);
              delay_msv(1000);                             
              delay_msv(1000);                             
              output_low(led_red);
              count++;                                     
              write_eeprom(20,count);                     
        }
        x = read_eeprom(20);                           
        if(x>=4){                                   
           output_high(buzzer);                         
           if (D1==1){        //key D1                     
         write_eeprom(20,0);                           
      }
    }
    delay_ms(10);                                 
  }
}

PS: The function "pulse()" is a library named "cuscostdio" created by a professor based on the standard library of CCS.
If anyone has a toggle function and can send me, because the "pulse" (pulse) is equal.
_________________
Thanks.

jrgob
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group