__delay_ms() problem (between switches)

Thread Starter

Hussain Talha Al Roomi

Joined Jul 23, 2015
2
Hello i am working on my project and i have to switch my switches which are connected to the pins of pic16f877a, hitech compiler by simply putting them to "on" and "off" state and by giving delay of 1 milli sec between on and off.
i am a beginner and i dont know how to write the program for this.
switch1 is connected to RA2
switch2 is connected to RA4
switch3 is connected to RA3
switch4 is connected to RB1
switch5 is connected to RA5
switch6 is connected to RB3
switch7 is connected to RA0
switch8 is connected to RA1
switch9 is connected to RD0
switch10 is connected to RD1
switch11 is connected to RD2
switch12 is connected to RD3
switch13 is connected to RD4
switch14 is connected to RD5
switch15 is connected to RB2
switch16 is connected to RB6

JUST help me write a code for 2 switches like if i want to put switch 1 and switch2 "on" and all other switches "off" and then give delay of one milli sec and do the same like put switch3 and switch4 "on" and all other switches "off"
 

korchoi

Joined Jun 5, 2015
59
Hello i am working on my project and i have to switch my switches which are connected to the pins of pic16f877a, hitech compiler by simply putting them to "on" and "off" state and by giving delay of 1 milli sec between on and off.
i am a beginner and i dont know how to write the program for this.
switch1 is connected to RA2
switch2 is connected to RA4
switch3 is connected to RA3
switch4 is connected to RB1
switch5 is connected to RA5
switch6 is connected to RB3
switch7 is connected to RA0
switch8 is connected to RA1
switch9 is connected to RD0
switch10 is connected to RD1
switch11 is connected to RD2
switch12 is connected to RD3
switch13 is connected to RD4
switch14 is connected to RD5
switch15 is connected to RB2
switch16 is connected to RB6

JUST help me write a code for 2 switches like if i want to put switch 1 and switch2 "on" and all other switches "off" and then give delay of one milli sec and do the same like put switch3 and switch4 "on" and all other switches "off"
Nice zombification of the thread. Did you bring a birthday cake or a flower bouquet ?
This is a bad practice on any typical forum on the internets. Just open up your own thread.
You want to know how to write delay_ms(ms)? How about we tell you first how make bacon and eggs? or how to get an RC car from point A to point B?
Before reviving 5 year old threads, check online info on this (very basic) stuff.
Look up "C programming basics" before anything. You will get an idea on how this whole code thing works.
Here is the first baby crawl into this world.
https://www.arduino.cc/en/reference/delay
On the C code for PIC microcontrollers, instead of functions like "digitalWrite" and "digitalRead" you use the names of the registers to manipulate their contents. With that said, change the values stored in the PORT registers, which direct to the external pins.
In doubt, check the datasheet. It has everything except compiler quirks.
No more posts here. I, for example, will not read what you post here from now on. Make your own thread, if this question was not already asked and answered in The forums.
 

ErnieM

Joined Apr 24, 2011
8,377
Hi Roomie, welcome to the forums.

A "switch" is usually used as an input device. When you say "if i want to put switch 1 and switch2 "on" and all other switches "off"" what are you doing using the PIC to these switches to make them on or off?
 
Top