micro chip is also viewing, Mr. Giann is looking it. They say XC8 is full free in the google. but no compiling is happening. I am attaching some screen shots . Pl. see any thing I am missing to do while using the MPLAB. Also I have not yet connected PICKIT3/4 to o/p device, will this create any problem for generating hex file?
/*
- File: source_vinod_controller.c
- Author: Admin
-
- Created on 16 November, 2021, 11:33 PM
*/
// PIC16F877A Configuration Bit Settings
// ‘C’ source line config statements
// CONFIG
#pragma config FOSC = EXTRC // Oscillator Selection bits (RC oscillator)
#pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
#pragma config BOREN = OFF // Brown-out Reset Enable bit (BOR disabled)
#pragma config LVP = ON // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3/PGM pin has PGM function; low-voltage programming enabled)
#pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
#pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
#pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.
#include <xc.h>
#include <xc.h>
unsigned int c1;// call for g connected to RA0
unsigned int c2;// call for 1 -------"—RA1
unsigned int c3;// call for 2 -------"—RA2
unsigned int usl;// Reed for slowdn., indicator changing RA3
unsigned int pups = 0;//previous up reed
unsigned int dsl;// ------"---------------- RA4
unsigned int pdns = 0;//previous dn reed
unsigned int dts;// dn.terminal slowdn. limit sw. RA5
unsigned int uts;// up-------------------"-------- RA6
unsigned int dns;// down normal stop limit sw. RA7
unsigned int pi1;// pi i/p lsb ------ ------ RB0
unsigned int pi2;// —"-- msb RB1
unsigned int dz;// door zone reed ------ ---- RB2
unsigned int po1;// pi o/p lsb RC0
unsigned int po2;// -----"---- RC1
unsigned int up;// up relay actvn. RC2
unsigned int dn;// dn ----"---- RC3
unsigned int hsu;// high speed actvn.4 up dir. RC4
unsigned int hsd;// -------"---------- dn dir. RC5
unsigned int rs1;// reset c1 call RD0
unsigned int rs2;// reset c2 call RD1
unsigned int rs3;// reset c3 call RD2
void uptravel()
{RC2 = 1;//up relay on
RC4 = 1;//hsu on
if(RA3 && !pups )//upslow reed on -------indicator setting
{pups = 1;
if(RB0 && !RB1)//car at g
{RC0=0; RC1=1;}//pi set to 1st fl.
if(!RB0 && RB1)//car at 1
{RC0=1; RC1=1;}//pi set to 2nd fl.
}
if(RA3==0 && pups ==1)//reset pups
{ pups = 0;}//reset pups // ----------------------"---------------"
if (RA1 && !RB0 && RB1)//car slowed dn at 1st fl 4 1st fl.call
{RC4=0;}//hsu off
if (RA1 && !RB0 && RB1 && RB2)//car stop at 1st fl dz=1
{_Delay(500)
RC2 = 0; RD1=1;//up contctr. off, reset c2 call on------"----------
_Delay(2000);
RD1=0;}//end of 1st fl. call process
if ((RA2 && RB0 && RB1)||(RA6))//car slowed dn at 2nd fl 4 top fl.call with uts
{RC4=0;}//hsu off
if (RA2 && RB0 && RB1 && RB2)//car stop at 2nd fl
{_Delay(500)
RC2 = 0;RD2=1; // up relay off, reset of c3 start ----"----------
_Delay(2000);
RD2=0;}
}//
void dntravel()
{RC3 = 1;//dn relay
RC5 = 1;//hsd on
if(RA3 && !pdns )//dn slow reed on -------indicator setting
{pdns = 1;
if(RB0 && RB1)//car at 2
{RC0=0; RC1=1;}//pi set to 1st fl.
if(!RB0 && RB1)//car at 1
{RC0=1; RC1=0;}//pi set to g fl.
}
if(RA3==0 && pdns ==1)//reset pups
{ pdns = 0;}//reset pups // ----------------------"---------------"
if (RA1 && !RB0 && RB1)//car slowed dn at 1st fl 4 1st fl.call
{RC5=0;}//hsd off
if (RA1 && !RB0 && RB1 && RB2)//car stop at 1st fl, dz=1
{_Delay(500)
RC3 = 0; RD1=1;//dn off, reset RA1(c2) --------------"----------
_Delay(2000);
RD1=0;}
if ((RA0 && RB0 && !RB1)||(RA5))//car slowed dn at g fl 4 g fl.call with dts
{RC5=0;}//hsd off
if (RA0 && RB0 && !RB1 && RB2)//car stop at g fl dz=1
{_Delay(500)
RC3 = 0; RD0=1;//dn relay off,reset at g on --------------"----------
_Delay(2000);
RD0=0;} }
void main(void) {
{
ANSELA =0;//SET ALL PORT A BITS DIGITAL
ANSELB =0;// -----"-----B —"-----
TRISC =0x00; //set port C pins as a digital output pin
TRISD =0x00; //set port D pins as a digital output pin
TRISA =0xFF; //set port A pins as a digital i/p pins
TRISB =0xFF; //set port B pins as a digital ----"—
RD0=0; RD1=0; RD2=0;
while(1)
{if((RA2 && !RB0)||(RA2 && !RB1)||(RA1 && !RB1))//2nd fl.callRA2,1st fl.call RA1
{uptravel;}
if((RA0 && RB1)||(RA1 && RB0 && RB1)||(RB0==0 && RB1==0))//g callRA0,1st fl. callRA1,ind. setting
{dntravel;}
/*RC0 = 1; // set RC0 pin to logic High & turn on
__delay_ms(1000); //add delay of 1 second
RC0 = 0; // set RC0 pin to logic low & turn off
__delay_ms(1000); //add delay of 1 second
*/
}
return;
}
This is the program I am trying to build on 16f887. But can not build the code. I am very small business man I can not afford to buy dongle or work station now. Pl. see i want to use now for two controller constn. if pic is not free software. I have to try for Arduino or any other free software. how about Arm? Is arduino good for professional work? many people say it is for school projects or hobby work like that. Also I am doing some periferal ckt. since i don’t need to have infinite loop working 24/7, when there is a call it should turn on the MCU and start the loop, after about 10mts. if no call is registered for elevator then MCU shoud stop the loop and stay on standby, is it possible to use sleep mode for this work or can i stop vcc to the MCU if no call is registered with in 10 mts.? Pl. see and solve this issue also.
Waiting to hear from you.