View previous topic :: View next topic |
Author |
Message |
Linuxbuilders
Joined: 20 Mar 2010 Posts: 193 Location: Auckland NZ
|
#use |
Posted: Fri Oct 28, 2016 12:47 am |
|
|
Good day,
Is it allowed and politically correct to use
#use fixed_io(X_outputs=outx)
inside the program to dynamically change definition of the ports?
I have noticed that once I do not declare the output as a fixed one then the output does not stay permanently ON after activation.
output_high (SLOT0); or output_low (SLOT0); will be deactivating after random time. It stays permanently ON only if I declare it as a fixed one.
Advise please. Thnx _________________ Help "d" others and then you shell receive some help from "d" others. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19366
|
|
Posted: Fri Oct 28, 2016 1:09 am |
|
|
If it is going off, something in your code or hardware is turning it off.
None of the I/O statements have a time component.
However it is important to understand the I/O nature of the PIC. You may be hitting the RMW (read modify write) problem. Depends on what PIC is involved (later chips allow writing to the latch as opposed to directly to the 'port', to avoid this).
Look at:
<http://www.ccsinfo.com/forum/viewtopic.php?t=48904&highlight=pic+rmw+problem>
<http://www.ccsinfo.com/forum/viewtopic.php?t=33425&highlight=pic+rmw+problem>
<http://www.ccsinfo.com/forum/viewtopic.php?t=45038&highlight=read+modify+write>
Dozens of other threads here, and much more generally on-line.
Key thing is that it implies a hardware overload (or capacitive load meaning the pin is taking significant time to change). This really needs to be fixed...
However since locking TRIS seems to be affecting things, I'd be looking at anything else in your code that might affect TRIS. Any TRIS statements?. Is the pin involved one that the compiler may be wanting to use for a peripheral? (remember if - for instance, the pin is one like a serial pin, then a serial setup, would override the TRIS, but then fixed_io would set it back at the next I/O statements). |
|
![](templates/subSilver/images/spacer.gif) |
Linuxbuilders
Joined: 20 Mar 2010 Posts: 193 Location: Auckland NZ
|
|
Posted: Fri Oct 28, 2016 1:32 am |
|
|
18F4620 pin RB1 which is INT1 and AN10, AN function is set to off so it can only be INT1 which I do not use. I do not declare pull ups, is it possible that pull up gets ON if fixed IO is not used? This would explain why led goes off...
I have checked the code and there is no control on this pin apart of one trigger.
Thnx _________________ Help "d" others and then you shell receive some help from "d" others. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19366
|
|
Posted: Fri Oct 28, 2016 1:34 am |
|
|
What is the current limiting resistor on your LED?. |
|
![](templates/subSilver/images/spacer.gif) |
Linuxbuilders
Joined: 20 Mar 2010 Posts: 193 Location: Auckland NZ
|
|
Posted: Fri Oct 28, 2016 1:43 am |
|
|
470 _________________ Help "d" others and then you shell receive some help from "d" others. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah
Joined: 11 Mar 2010 Posts: 19366
|
|
Posted: Fri Oct 28, 2016 1:49 am |
|
|
Hmm. Big enough.
_Something_ in your code must be affecting the TRIS. Any 'input' statement on port B, could potentially override it. An 'input_b', would set all the bits to input for example. This is what 'fixed_io' would override. |
|
![](templates/subSilver/images/spacer.gif) |
Linuxbuilders
Joined: 20 Mar 2010 Posts: 193 Location: Auckland NZ
|
|
Posted: Fri Oct 28, 2016 1:56 am |
|
|
Thnx, i dig it and report _________________ Help "d" others and then you shell receive some help from "d" others. |
|
![](templates/subSilver/images/spacer.gif) |
|