Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Stuck in ISR PIC16F876A Issue mikroC Pro 5.60

Status
Not open for further replies.

dexter0904

Junior Member level 3
Joined
Mar 21, 2011
Messages
25
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Location
Never Land
Activity points
1,444
Hello Guyz...
After 48 hours of being Stuck, I decided to post my problem here and expect some experts will guide me what is wrong with me writing code or what is wrong with the mikroC_Pro_5.60... ;-)

So here is what I'm Trying to do...


Expected Results


>>Main Function<<
Hyper Terminal Commands..
1--> Displays "CH1"
2--? Displays "CH2"
3--> Displays "CH3"
e--> Call RequestPassword() Function
E--> Call RequestPassword() Function

>>RequestPassword()<<

if Password if not successfull
Displays "Incorrect Password" and return back to main Function

>>EditReadings()<<

if password is Successfull
Return back to main Function and call EditReadings() Function


The Program outpu is deviating from expected operation like..
1. The decimal point in Voltage Readings disapeares...

Some times it comes back by commenting some line..

>like UART1_Write_Text();
>Enable Interrupts();(Line Number 98)
etc

2. Some Times Program Stucks, somewhere like while(ChracterReceived==0);
and some times at some other place(most probably ISR)


Note: Channel 1,2 and 3 are not Adc Channels of PIC,
Actually Voltages of 3 Channles are sent to PIC on single line..
and can be selected from PushButtons or from sending proper commands from HyperTerminal

1. Link to Source Files and Proteus Simulation
HTML:
http://www.4shared.com/rar/AsszAnPV/PIC16F876A_Issue.html?
2. Link to MikroC Pro 5.60 Portable
HTML:
http://www.4shared.com/file/Uc_AMdQs/MikroC_PIC_560_Portable.html?
3. Link to Proteus 7.7 Portable
HTML:
http://www.4shared.com/rar/Mltluzre/Proteus_77_Portable.html?

Regards,
Waqas
 

The code is pretty big. So, before I take a look through it, it would be nice if you could provide an explanation of what happens when and how I should go about it. Basically just explain the operation of the code. And explain the exact mistakes you're encountering.
 
Basically, The Code is to save these things in EEPROM
1. Channel Number <1-3>
3. Function Number(Primary Search Key)<2 digit Array>
2. Start Voltage Value of a Function <4 digit array>
3. End Voltage Value of the Function<4 digit array>
4. Function Title (4 digit array)

So that When Editing is complete PIC16f876a can decided on basis of Voltage on the input channel, what Function Number and Name(Title ) is...

you can run proteus simulation to see whats happening...
Have you seen Image file Inside the folder " PIC16F876A_Issue"?

Any other details...?
 

If you suggest some Modifications which can prevent unexpected execution in my code, It would be of great help...
 

I'll let you know. The code is pretty big. So, I'll need to go through it in detail.
 

I'm expecting some experts to answer...

I have made some changes to my code, it is really simplied and shortened now... But few problems still prevail, e.g.,

1. No decimal point in Adc Voltage value(29994 instead of 29.994 ), when I remove every thing from EditReadings() Function, it comes back to normal, even not a single variable is shared(Global) b/w main() and EditReadings() exept temp, which is necessary...

2. Stuck in perhaps while-Loop when asked for save or not...
3. 3rd Element of EndValue[] returns line feed when echoed back to Hyper Terminal to check
wether it has taken true value...

I'm writing my own Adc Routine, instead of using MikroC's built-in one..
I'll show my modified code when it is desent enough to be easily understood...

My Questions...
Now, my ISR size is 187-Bytes...? is it really big to create problem...?
Though, I'm further modifing code to make ISR size max 90-Bytes(Is it Ok ?)
 

hi guyz...
Thanx for your kind support... (or what ever it is..)...It was a MikroC problem....Good Bye MikroC (perhaps for ever...)
CCS Rockx....
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top