hello fellow lovers of micro controllers
i speak as a rookie in the game and i am programing a PIC16f877a.
i am using PIC simulator IDE but if aint looking good for me..
the thing is i have to use this PIC SIMULATOR IDE cause it's a joint project.
if anyone can help me with writting code in C for my project please by all means.
this is how i am starting my code, and if possible, let me know if you can help me fix it up.
the idle state of the project is all pins are logic low, when i hit a panic button (i.e. the pin gets a high) i need another pin to go high...
let me know if my if statements are ok.. thanks ..
and i'll be online a lot in the next week or so.. i would like a mentor...
if you out there.. don't be shy and i'll be glad to hear on wisdom from pros..
thanks
WHO?
// the start of my project looks like this...
i am using pic simulator ide ( basic compiler)
TRISA = 0xff ' INPUT
TRISB = 0x00 ' OUTPUT
TRISC = 0x00 ' OUTPUT
TRISD = 0xff ' INPUT
TRISE = 0x00 ' OUTPUT
' INITIALIZE PORT C AND D AS LOGIC LOW (0)
PORTA = 0xff
PORTB = 0
PORTC = 0
PORTD = 0
PORTE = 0
' instead of writing the output or input port and pin
' we used a shortcut using SYMBOL and then the name of the PIN
Symbol buzzer = PORTC.1
Symbol sec_center = PORTC.2
Symbol to_voice_1 = PORTC.4
Symbol to_voice_2 = PORTC.5
Symbol panic_1 = PORTD.4
Symbol panic_2 = PORTD.5
Symbol panic_3 = PORTD.6
main:
panic: If panic_1 = 1 Then ' SITUATION FOR PANIC BUTTON 1
sec_center = 1
WaitMs 1000
Endif
If panic_2 = 1 Then ' SITUATION FOR PANIC BUTTON 2
sec_center = 1
WaitMs 1000
to_voice_1 = 1
WaitMs 1000
to_voice_2 = 1
WaitMs 1000
Endif
If panic_3 = 1 Then ' SITUATION FOR PANIC BUTTON 3
buzzer = 1
WaitMs 1000
sec_center = 1
WaitMs 1000
to_voice_1 = 1
to_voice_2 = 1
Endif
Goto panic
i speak as a rookie in the game and i am programing a PIC16f877a.
i am using PIC simulator IDE but if aint looking good for me..
the thing is i have to use this PIC SIMULATOR IDE cause it's a joint project.
if anyone can help me with writting code in C for my project please by all means.
this is how i am starting my code, and if possible, let me know if you can help me fix it up.
the idle state of the project is all pins are logic low, when i hit a panic button (i.e. the pin gets a high) i need another pin to go high...
let me know if my if statements are ok.. thanks ..
and i'll be online a lot in the next week or so.. i would like a mentor...
if you out there.. don't be shy and i'll be glad to hear on wisdom from pros..
thanks
WHO?
// the start of my project looks like this...
i am using pic simulator ide ( basic compiler)
TRISA = 0xff ' INPUT
TRISB = 0x00 ' OUTPUT
TRISC = 0x00 ' OUTPUT
TRISD = 0xff ' INPUT
TRISE = 0x00 ' OUTPUT
' INITIALIZE PORT C AND D AS LOGIC LOW (0)
PORTA = 0xff
PORTB = 0
PORTC = 0
PORTD = 0
PORTE = 0
' instead of writing the output or input port and pin
' we used a shortcut using SYMBOL and then the name of the PIN
Symbol buzzer = PORTC.1
Symbol sec_center = PORTC.2
Symbol to_voice_1 = PORTC.4
Symbol to_voice_2 = PORTC.5
Symbol panic_1 = PORTD.4
Symbol panic_2 = PORTD.5
Symbol panic_3 = PORTD.6
main:
panic: If panic_1 = 1 Then ' SITUATION FOR PANIC BUTTON 1
sec_center = 1
WaitMs 1000
Endif
If panic_2 = 1 Then ' SITUATION FOR PANIC BUTTON 2
sec_center = 1
WaitMs 1000
to_voice_1 = 1
WaitMs 1000
to_voice_2 = 1
WaitMs 1000
Endif
If panic_3 = 1 Then ' SITUATION FOR PANIC BUTTON 3
buzzer = 1
WaitMs 1000
sec_center = 1
WaitMs 1000
to_voice_1 = 1
to_voice_2 = 1
Endif
Goto panic