Qaisar Azeemi
Full Member level 5
- Joined
- Feb 11, 2011
- Messages
- 315
- Helped
- 16
- Reputation
- 32
- Reaction score
- 15
- Trophy points
- 1,298
- Location
- Peshawar, Pakistan, Pakistan
- Activity points
- 3,829
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 #include<Pic16F877A.h> //#include <htc.h> void DELAY_ms(int); void main() { unsigned char j=1; TRISC=0; for( ; ; ) { PORTC=j; DELAY_ms(1000); j=j<<1; if (j==0) j=1; } } void DELAY_ms(int x) { int i,j; for(i=0; i<x; i++) for(j=0; j<500; j++); }
:060000000A128A11972F7D
:100F2E0083010A128A119B2FF9010314F90D8316FE
:100F3E0003138701A22F7908831203138700E83069
:100F4E00F0000330F1000A128A11C2270A128A1128
:100F5E007908F7007707F8007808F900F908031DFB
:100F6E00B92FBA2FA22FF9010314F90DA22FA22F18
:100F7E000A128A110028F301F401F02FF501F6018F
:100F8E007608803AFF0081307F02031DD02FF430A7
:100F9E007502031CD32FD42FD62FEA2FEA2F013040
:100FAE00F5070318F60A0030F6077608803AFF00B8
:100FBE0081307F02031DE52FF4307502031CE82FEC
:100FCE00E92FD62FEA2F0130F3070318F40A003069
:100FDE00F4077408803AF2007108803A7202031D19
:100FEE00FA2F70087302031CFD2FFE2FC52FFF2F43
:020FFE000800E9
:00000001FF
You cannot read while it is code protected. In the window, setting is other way around. selecting 0 will protect code and selecting 1 will disable code protection. Similar is the case with other settings. Apparently it is reverse.
hi azimi
first of all u have to do this
1) as u r beginner so use mikroc and get full version from me
2) if u r using hitech which is very gd compiler thenerase #include <pic16f877a.h>
3) and u have to use configuration setting also here that u have nt done
__CONFIG(1, OSCSDIS & HS);
__CONFIG(2,BOREN & BORV42 & PWRTEN & WDTDIS);
__CONFIG(3, CCP2RC1);
__CONFIG(4, DEBUGDIS & LVPDIS & STVRDIS);
__CONFIG(5, UNPROTECT); // Chnage to CPA
__CONFIG(6, WPB);
__CONFIG(7, TRU);
wish u best of luck
remember me in ur prayers
Use 0.1uF capacitor on power pins of ic. Just solder on the track side on ic pins so that it is very close to ic.
i did it but fall into another problem..... :-( it pulled up the supply voltages from 4.67v to 5.03v but circuit stopped working..... prior to this the circuit started working when i touched or shake the crystal a little bit, i thought it may be soldering (loose connections) problem but now the situation is completely changed.... and i cant understand why.... :-( just thinking what to do and searching the reason for that.......................................... i reburned the program into the Chip again and insert it in the socket; circuit started working but when i power OFF the supply and Power it ON again ..... :-( the same problem occurred......................... now........ ..... .....
This sounds like a common problem of a reluctant to start crystal. The higher the frequency of a crystal the more critical of the layout to get reliable start up. Above 8Mhz you will not be able to use strip or vero board and get reliable start up in my experiance. Did you use the corect value of capacitors (15pf) in the crystal circut, and have you set the configuration word to HS mode?
show circuit
- - - Updated - - -
ur problem is here due to #include<htc.h>
and u have not configured its register like wdten etc by _config command
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?