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 support@ccsinfo.com

ccs c pic16f88 port blink

 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
tari



Joined: 14 Jun 2014
Posts: 1

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

ccs c pic16f88 port blink
PostPosted: Tue Nov 15, 2016 12:48 pm     Reply with quote

Code:
/* port_blink.c
By Tarilayefa Edward
tarielect.edward@gmail.com
Date: 15/11/2016.
A simple port blinking code that flashes port a and b on/off
at the rate of t1 milliseconds.
Compiler: PCWHD Compiler v5.008
PIC16F88 used.
*/

#include <16F88.h>  //include pic16f88 header file
void main(void) {

//#byte OSCCON = 0x60  //4MHz 0scillator
#byte OSCCON = OSC_4MHZ  //4MHz 0scillator
//#byte OSCCON = 0b01101000  //4MHz 0scillator
//#Fuses NOWDT,WDT,PUT,NOPUT,LP,XT,HS,EC_IO,INTRC_IO,INTRC,RC_IO,RC
#Fuses INTRC_IO             //internal osc used with a6, a7 as digital pins
#use delay(clock=4000000)  //4mhZ CLOCK SPEED
setup_adc(ADC_OFF);

set_tris_a( 0x00 ); //SET port a to output
OUTPUT_a(0x00);     //turn off porta
set_tris_b( 0x00 ); //SET port b to output
OUTPUT_b(0x00);     //turn off portB

int16 t1;     //declare t1 as 16bit variable (0 to 65535)
t1 = 1000;   //t1 in milliseconds


While(TRUE) {              //main loop
//OUTPUT_HIGH(PIN_B0); //turn on portb.0
OUTPUT_a(0xff);       //turn on porta
output_b(0xff);       //turn on portb
DELAY_MS(t1);         //delay for time t1 ms
//OUTPUT_LOW(PIN_B0); //turn off portb.0
OUTPUT_a(0x00);       //turn off porta
output_b(0x00);       //turn off portb
DELAY_MS(t1);
}
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library 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