CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug Reports on this forum. Send them to support@ccsinfo.com

Program stopping in function #use delay ()
Goto page Previous  1, 2, 3
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
jacktaylor



Joined: 02 Sep 2017
Posts: 70

View user's profile Send private message Send e-mail

Thank all friends.
PostPosted: Tue Jan 30, 2018 11:25 am     Reply with quote

Okay. Leave aside my doubt. Nobody answered because the code does not run, they only did the answer based on Proteus and not my doubt of the code, being my problem is not in Proteus but in the CCS code .. I asked the same question over and over again. I'm going to run this code in the other compiler .. I give up !!!!


temtronic wrote:
re:
Quote:

But I keep insisting that here, on my PC, I can see it working on Proteus, but with the program done in another compiler .... I managed to make this program run with this other compiler already 13 days ago and since then, I have tried without success in CCS.

As I've said before Proteus (ISIS really) is busted. So they got the simulator portion OK for the other compiler BUT they got it WRONG for the CCS compiler. What I don't understand is why anyone has blind faith in a product that is known to be faulty, reminds me of the BSOD for certain Windows versions.

There is working DS18B20 code in the 'code forum' here and I know it works. I have a couple products running it for the past few years.
Ttelmah



Joined: 11 Mar 2010
Posts: 13654

View user's profile Send private message

PostPosted: Tue Jan 30, 2018 11:41 am     Reply with quote

Seriously you have had dozens of answers showing how to make your code work. Your basic little routine, at no point pulls A0 up. No wonder you won't see it going up. Also the rate is so slow, that you need a stopwatch to see it move, rather than an oscilloscope.
Your code is written badly, and you confuse yourself by incorrect comments.

If you are happy with the other compiler then go off and use it.

CCS is a very good compiler (I have four others, and come back to CCS every time, to produce code more quickly and with less problems), but it does require you to learn how to use it.
jacktaylor



Joined: 02 Sep 2017
Posts: 70

View user's profile Send private message Send e-mail

Friend Ttelmah
PostPosted: Tue Jan 30, 2018 11:46 am     Reply with quote

So this code that is running completely when debugging in MPLAB CCS indicates that it will work when physically mounted? Is there any way to simulate without having to mount? For this is the purpose of PROTEUS software, to simulate before assembling, but the same, according to your comment, has failure. To this day all the projects that I have simulated in him worked without exception. But you say it does not work. Is there any way to simulate? For me the PIN_A0 is not oscillating is due to some error in the use of some function used in the CCS.

Ttelmah wrote:
Seriously you have had dozens of answers showing how to make your code work. Your basic little routine, at no point pulls A0 up. No wonder you won't see it going up. Also the rate is so slow, that you need a stopwatch to see it move, rather than an oscilloscope.
Your code is written badly, and you confuse yourself by incorrect comments.

If you are happy with the other compiler then go off and use it.

CCS is a very good compiler (I have four others, and come back to CCS every time, to produce code more quickly and with less problems), but it does require you to learn how to use it.
Ttelmah



Joined: 11 Mar 2010
Posts: 13654

View user's profile Send private message

PostPosted: Tue Jan 30, 2018 12:04 pm     Reply with quote

I think it may be a simple misunderstanding.

Do you understand what 'float' means in terms of an electronic output?.

An pin is described as 'floating' when it's drivers are turned off.

So your code turns the pin on, and drives it low, but then turns it _off_, and loads a high value in the output latch. Because the drivers are 'off', nothing will happen. No oscillation.

This is why I was trying to point out to you your error when talking about the TRIS. A pin only drives (generates an output), when it's TRIS is set to '0' (for Output). When set to '1' it is an input.
Ttelmah



Joined: 11 Mar 2010
Posts: 13654

View user's profile Send private message

PostPosted: Tue Jan 30, 2018 12:18 pm     Reply with quote

And, no. The only way to 100% find that code works is to try it in a chip. The best simulators are poor, giving only perhaps 65% accuracy. ICD systems give perhaps 95% 'real' behaviour. ICE systems get to 99.9%, but cost a huge amount.
jacktaylor



Joined: 02 Sep 2017
Posts: 70

View user's profile Send private message Send e-mail

Hi Ttelmah
PostPosted: Tue Jan 30, 2018 3:20 pm     Reply with quote

Then output_drive (PIN_A0); Turn the pin
output_low (PIN_A0); play the pin down right?
output_float (PIN_A0); should not you call again and the pullup resitor throw the pin up? This is my doubt..this does not oscillate.
I tested this library ready

https://www.ccsinfo.com/forum/viewtopic.php?t=28425

and got to see the swing. In this library the author does not use output_drive (PIN_A0), only the output_float (PIN_A0); I modified it in my project by removing output_drive (PIN_A0), set_tris (x) and also standard_io (x). But PIN_A0 has not yet oscillated.



Ttelmah wrote:
I think it may be a simple misunderstanding.

Do you understand what 'float' means in terms of an electronic output?.

An pin is described as 'floating' when it's drivers are turned off.

So your code turns the pin on, and drives it low, but then turns it _off_, and loads a high value in the output latch. Because the drivers are 'off', nothing will happen. No oscillation.

This is why I was trying to point out to you your error when talking about the TRIS. A pin only drives (generates an output), when it's TRIS is set to '0' (for Output). When set to '1' it is an input.
temtronic



Joined: 01 Jul 2010
Posts: 6286
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 30, 2018 3:51 pm     Reply with quote

output_float(pin) effectively disconnects the PIC from whatever it is connected to. Consider it to be a 'switch' between the PIC's internal output logic and the physical pin connection.

OLD school we call it 'tri-state', where a pin can have THREE states
1) ON...VDD (+5)
2) OFF...VS (gnd)
3) High Impedance (not connected)

This 3rd state allows several devices to be connected together and any of them can send or receive data.

Perhaps this clears up your confusion.

Jay
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3
Page 3 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group