Hi,
This is my first time using Micro C, I am tring to program a simple LED flashing on a PIC16F628A.
But I can't get it to work. My code looks like this:
#include "built_in.h"
void main(){
TRISA = 0x00;
PORTA = 0x00;
CMCON = 0x07;
while(1){
PORTA = 1;
Delay_ms(1000);
PORTA = 0;
Delay_ms(1000);
}
}
Please Help!
Problems with PIC16F628A LED flashing
-
- Posts: 158
- Joined: 17 Jan 2009 21:33
Re: Problems with PIC16F628A LED flashing
Have a look to this compilation of useful links:jacofaj wrote:Hi,
This is my first time using Micro C, I am tring to program a simple LED flashing on a PIC16F628A.
But I can't get it to work. My code looks like this: ...
http://www.microchip.com/forums/fb.aspx?m=358934
In the second chapter "General Circuit-Design-Questions:", you will find the link "Help, my first PIC-project won't work:". In this post from Dale you will find the most common problems mentioned, why the PIC doesn't work as expected.
Btw, your code looks good, as far as I can say.
Hope this helps,
Stefan
Still not working
Hi,
I tried all the advice, but no success.
I think it is in my configuration.
so if any one can give me an example of
the required config for a PIC16F628A with internal osc,
it will help.
Thanks
Jaco
I tried all the advice, but no success.
I think it is in my configuration.
so if any one can give me an example of
the required config for a PIC16F628A with internal osc,
it will help.
Thanks
Jaco
-
- Posts: 2780
- Joined: 25 Dec 2008 15:22
- Location: Scotland
yes you can... and the format is as shown by CVMichael above. you can have any combination within the same source code. you can even use different formats on the same port at different times in the same source.MD5 wrote:Thx Michael,
Can we set in the application the porta status in Decimal, portb in hex or binary?
Example:
PORTA = 255;
Or
PORTB = 0xFF;
Just for info...
Regards,
Sam
e.g this is perfectly valid (duplication for demo purpose, but you could do it if you want)
TRISA = 0x0;
TRISA = 0b00000000;
TRISA = 0;
// an 8 bit memory walk
PORTA = 255;
PORTA = 0xAA;
PORTA = 0b01010101;
PORTA = 0;
-
- Posts: 3
- Joined: 09 Jun 2014 09:19
Re: Solved
how you config sir?jacofaj wrote:Hi,
Solved the problem.
It was in the config.
Thanks for all your help!!!
im stucking here for afew day