Click here to Skip to main content
15,887,242 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need help with the program below. I wrote it with pascal lung and, when I compiled it with micro pascal to hex files, there is an error and I need some help to find it.

Thank you

Pascal
Program programme;
Var l,i:longint;
Label L1;
begin
trisb:=$FC;
trisc:=$FF;
trisa:=$FF;
ADCON1:=$8E;
portb:=0;
while (true) do
begin
L1:
i:=0;
portb:=0;delay_ms(5000);
l:=adc_read(0);delay_ms(10);
while ((l<512)and (portc.0=0)) do
                           begin
                           portb.0:=1;
                           l:=adc_read(0);delay_ms(100);
                            i:=i+1;
                            if i=50 then goto L1;
                            end;
portb:=0;
while ((l>512)and (portc.1=0)) do
begin
portb.1:=1;
l:=adc_read(0);delay_ms(100);
end;
end;
end.
Posted
Updated 7-Jun-11 0:07am
v3
Comments
DaveAuld 7-Jun-11 5:47am    
You say there is an error, and the error message would be? If no error message, what are the symptoms, what are you expecting it to do that it isn't.
CPallini 7-Jun-11 6:07am    
Please elaborate: "there's a problem" is just a vague sentence. You should provide full error message.
thatraja 7-Jun-11 6:30am    
Include the error message in your question always

1 solution

First rules:
1) We need the error message, or some idea of what the error is.
2) Indentation helps you (and us!) to actually read the code. At the moment, it is a mess - tidy it up so we can easily see what is going on.
3) Don't use goto in Pascal and then ask for help unless it is absolutely obvious there is a need for it! At the moment, I can't see if it is needed, and can't be bothered to work out if it is.

Use the "Improve question" widget to change you question, and we will see what we can do...
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 7-Jun-11 13:33pm    
Very good points, my 5.
Please see OP's responce in "solution" (deleted), later re-posted as
http://www.codeproject.com/Questions/207759/error-in-my-program-of-solar-tracker

I answered it.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900