Solving an intermittent 18F2431 PIC problem

Thread Starter

camerart

Joined Feb 25, 2013
2,611
I am not seeing any of those questions answered in this thread. Again, why are you making it so difficult for others to help you. Even if you need to answer the same questions twicw even three times, it is all of us taking our time to try and help you. Not the other way around.
Hi S,
Sorry again. I must admit, that I have difficulty reading through the threads also.

Do you have a bypass capacitor? I presume you mean on between the pos and neg of the PIC? Yes, a 104 and a 220uF.

How is the circuit wired. Is it a PCB or is it a perf board.? PCB.

If PCB have you checked all of your solder joints? Any cold solder joints? On the PCB there are two slots for similar PICs, both act in the same way. I've checked for tracking between tracks, and continuity byt running a small motor through them where I could.

Hope that everything:)

C.
 

Thread Starter

camerart

Joined Feb 25, 2013
2,611
Hi C,
Have you corrected that CONFIG which was enabling LVP.?
E
Hi Eric,

Yes, corrected, as my question in #19

I'm still getting to grips with the (In my opinion) overblown MPLAB program.

I think that so far I have not been programming correctly with it. I am getting errors of too long file names, you did mention it many moons ago, but I write forgettable information in the name for ease of use.

I think the last one is trying to program correctly, but is giving this error:

C.
 

Attachments

spinnaker

Joined Oct 29, 2009
7,835
Hi Eric,

Yes, corrected, as my question in #19

I'm still getting to grips with the (In my opinion) overblown MPLAB program.

I think that so far I have not been programming correctly with it. I am getting errors of too long file names, you did mention it many moons ago, but I write forgettable information in the name for ease of use.

I think the last one is trying to program correctly, but is giving this error:

C.
Your pic is might be fried.

Or your programmer is bad.

Confirm that the pic is powered by measuring across the VDD and VSS pins.
 

spinnaker

Joined Oct 29, 2009
7,835
Whatever it is, it is contagious. I had a project that was working perfectly last night, now I am getting the exact same issue as the last one you posted. ;)
 

Thread Starter

camerart

Joined Feb 25, 2013
2,611
Whatever it is, it is contagious. I had a project that was working perfectly last night, now I am getting the exact same issue as the last one you posted. ;)
Hi S,

I use more than one PIC.

I have two programmers.

There is a 5v added power source switched on for programming.

Sorry that you've caught it, let's hope an answer turns up:)

C.
 

Thread Starter

camerart

Joined Feb 25, 2013
2,611
To my untrained eye, it appears that the program starts, and the LED flashes, then stalls, as the LED sometimes stays on. Having said that it could be the LED toggle.

C.
 

Thread Starter

camerart

Joined Feb 25, 2013
2,611
Hi,

I've made a simple breadboard circuit, with TX, RX, LED for initialisation etc and 4x LEDs as Hbridge outputs.EDIT: MCLR PULL UP, PGM PIN pull down. Power supply 5v battery with caps as before

The 'working' PIC initialises as before (intermittently), and when the required AxxxExxx is input to RX, two matching LEDs come on depending which direction the AxxxExxx directs. Once 'working' it will reset with PIN1 and repeat the operation many times, without fail.

All other PICs that have been re-programmed with copies of the 'working' PIC HEX program still never work.

EDIT: Strange phenomenon! Each time I place a PIC in the breadboard On initialisation the 'start-up' LED flashes as usual, plus some of the Hbridge LEDS. This only happens the first time. I can remove the PIC place it on earthing foam and replace it and the Hbridge LEDs will flash. It's not the capacitors between 5v and GND.

C.
 
Last edited:

spinnaker

Joined Oct 29, 2009
7,835
The best thing for your to do is start out simple. Breadboard it with only the pic, the supply, the bypass cap, the MCLR pull-up and the ICSP connector. Write a simple program to just turn on then off a bin out. Put it in debug mode and trace the code. Watch the bin out change with your scope, logic probe or what ever you have.


Speaking of which what was your supply again? Are you sure it is clean and no noise?
 

Thread Starter

camerart

Joined Feb 25, 2013
2,611
The best thing for your to do is start out simple. Breadboard it with only the pic, the supply, the bypass cap, the MCLR pull-up and the ICSP connector. Write a simple program to just turn on then off a bin out. Put it in debug mode and trace the code. Watch the bin out change with your scope, logic probe or what ever you have.


Speaking of which what was your supply again? Are you sure it is clean and no noise?
Hi S,

Did you read the previous post before writing this?

I have tried a separate breadboard, and with this program it work every time.

Battery power either 12V then 7805 or 5V battery pack.

I can't read code only PIC basic I'm afraid, when I use the Oshonsoft simulator, but with this program the simulator doesn't work.

C.
 

Attachments

ericgibbs

Joined Jan 29, 2010
13,280
but with this program the simulator doesn't work.
hi C,
Just downloaded your program into the IDE and it runs OK in simulation, the PORT pins on the micro-controller view shows alternate switching as per the program.

E
 

spinnaker

Joined Oct 29, 2009
7,835
Hi S,

Did you read the previous post before writing this?

I have tried a separate breadboard, and with this program it work every time.

Battery power either 12V then 7805 or 5V battery pack.

I can't read code only PIC basic I'm afraid, when I use the Oshonsoft simulator, but with this program the simulator doesn't work.

C.

Yeah I did. But it said you added everything. Did you read my post? It says simple. Did you try that? Did you try a simple program like I suggested?

If a simulator doesn't work then it means a problem with your code. The best thing to do is start off simple then build your code from there. Debugging along the way. Learn to use your debugger and test equipment.

Again, you have a pretty poor attitude for those trying to help.
 

Thread Starter

camerart

Joined Feb 25, 2013
2,611
Hi,

I'm sure this problem is only for this particular PIC 18F2431 and compiled in the Oshonsoft simulator IDE including the Quadrature module and sometimes the PWM module. As well as writing the programs, Eric Gibbs has written special ASM codes for QUAD and PWM that you will see in the program.

All simple programs work fine.

Eric,

Re: working in the SIM:

Here is a section from the Tracker thread you posted last year:
"If you recall Vladimir said that the quad module of the 18F2431 was not supported in the IDE.

I did say that I was testing which 'Oshonsoft Basic' statements existed for the quad module.
I was concerned that being told it was not supported, perhaps it did not create the machine code routines when compiling certain Basic statements.
So I went thru each Basic statement that Oshonsoft seemed to recognise [ when a recognised statement is typed in, it changes to upper case], I then checked the compiled/assembled code to see if the correct actual machine code was generated by the compiler.

I was then able to use the available Basic statements to construct a quadrature program module which works in a 18F2431.
NOTE: It will not work in the IDE simulator.)"

Is this still true? or have things changed? How were you simulating the QEI inputs?, was it with the above quadrature program? I tried the square wave module, but was unable to get it to work.

C.
 
Last edited:

ericgibbs

Joined Jan 29, 2010
13,280
hi,
I am referring to the program you posted in post #34, it works in the sim.
The Quad module in the 18F2431 is not supported by the IDE.
E
 

Thread Starter

camerart

Joined Feb 25, 2013
2,611
hi,
I am referring to the program you posted in post #34, it works in the sim.
The Quad module in the 18F2431 is not supported by the IDE.
E
Hi Eric,

I posted the program at #34 in response to Spinnakers post # who wanted me to try a simple program. This works every time.

I posted the program at #28 in response to your request to post the problem program at #24. The CONFIG4L has been corrected to HVP. Here it is again:

C.
 

Attachments

Thread Starter

camerart

Joined Feb 25, 2013
2,611
Hi,

Some tests! All programmed and run on an adapted socket with the PGM pin to GND.

Attached is a word document with images showing two terminals. First all of the tests were the same. Connect power>>Press reset button>>Enter A090E000, then repeated.

At the left is sending AxxxExxx to the RX of the pic. On the right is the result. If lines AxxxExxx have no 'result of movement' between them, then the motor did not turn.

Only the original PIC1 and the PIC1 copy on PIC6 programmed with LVP turn the motor. e,g, PIC6 programmed with HVP does not turn the motor.

I hope this is clear and understandable:)

C.
 

Attachments

Top