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

Preventing Problems Using MACH-X with PCWH

 
Post new topic   Reply to topic    CCS Forum Index -> CCS ICD / Mach X / Load-n-Go
View previous topic :: View next topic  
Author Message
Bill Havins



Joined: 20 Nov 2006
Posts: 14
Location: Texas

View user's profile Send private message

Preventing Problems Using MACH-X with PCWH
PostPosted: Fri Jun 08, 2007 9:45 am     Reply with quote

I have not been using the CCS Compiler for very long so be aware that my comments may seem elementary to long-time CCS users. One of the things that I have noticed about the CCS products is that their documentation often leaves me with unanswered questions. Indeed, I have sometimes been unable to get things to work because available documentation left out steps or was incomplete. This problem with documentation caused me some real frustration recently when I attempted to use my MACH-X programmer with the Debugger in the IDE. I won’t bore you with the details of the problems that I had. Instead, I offer the following steps that need to be taken to get the MACH-X to work with the IDE, including the Debugger.

(These comments relate to versions 4.013 through 4.040 of PCWH; I don’t know how they apply to earlier versions.)

If you have a MACH-X programmer, you are aware that it has three basic methods of programming chips. The first method is the ZIF socket (the “zero insertion force” socket). To program a PIC using this method, the PIC is inserted into the ZIF socket and the hex file is then “flashed” into the chip using the IDE or the “stand-alone” MACH-X software. This is the method that is used if the PIC is not already mounted in a circuit or circuit board. It’s the method that most of us use when we first start working with PICs.

The other two methods of programming PICs with the MACH-X are meant for use when the target PIC is already mounted in a circuit or circuit board. This is “in-circuit serial programming,” or ICSP. In both of these methods a six-wire cable is attached to the RJ-12 socket on the end of the MACH-X (the end opposite the USB cable socket). The socket is labeled “ICD.” The other end of this six-wire cable is plugged into, or attached to, a jack or header on the circuit that includes the target PIC. (The MACH-X comes with a six-wire cable that has RJ-12 plugs on both ends.)

In-circuit serial programming can be done in either of two ways with the MACH-X. In the first method, the MACH-X supplies voltage, or Vdd, to the target PIC. This method can be used when the PIC and its circuit/circuit board are not under power from another source.

In the other ICSP method, the MACH-X does not supply power to the PIC. As far as I know, when you want to perform in-circuit debugging of a program, this latter option is the one to choose. To debug a program, including an “in-circuit” PIC and its peripherals, the PIC’s circuit needs to be under power from its own power source. Under these circumstances you do not want the MACH-X to attempt to provide power to the PIC, so this “no power” option is the one to choose.

Here’s where the rub comes in. When using the IDE its “default” is to expect a target PIC to be in the ZIF socket (assuming that MACH-X software is already installed). If you attempt to program a chip, or if you run the Debugger, things won’t work the way you would expect. If you use the debugger while the IDE is “expecting” the MACH-X ZIF socket to be active, your MACH-X software may get corrupted. You may have to re-install your MACH-X software to get the IDE and the MACH-X software to recognize the MACH-X again.

To prevent problems when using the MACH-X with the IDE you have to let it know which of the MACH-X’s programming options you want it to use. Here’s how.

First, make sure that you have the latest MACH-X software and driver installed. Go to CCSinfo.com and check the “Downloads” page to make sure that your software and driver are the latest versions. You might also check your MACH-X firmware to see if it is the latest version. Download and install what you need.

Next, open your CCS C Compiler program. Click on the “Options” tab to go to the “Options” window. Once there, click on the “Tools” button. This will open the “User Defined Tools” window.

There is a three column table in that window. The columns are labeled “Name,” Usage,” and “Command.”

Look under the “Name” heading and, about four lines down, you will see “MACH-X.” Under “Usage” it should say “Tools”; this is the entry for use of the MACH-X from the Tools window of the IDE.

Under “Command” on that same line you will see the entry:

"C:\PROGRA~1\PICC\MACHX.exe" "-T%H" "%D"

The above line of code is the command that tells the IDE to use the ZIF socket of the MACH-X. It’s the “default.” This line of code needs to be modified if you want the IDE to use either of the other MACH-X programming options.

If you want to use the ICD jack on the MACH-X, and you want the MACH-X to supply power to the PIC, add a space and “1” to the end of the line (include the quotation marks). So the line of code will read:

"C:\PROGRA~1\PICC\MACHX.exe" "-T%H" "%D" "1"

If you want to use the ICD jack on the MACH-X, and you don’t want the MACH-X to supply power to the PIC, add a space and “2” to the end of the line (include the quotation marks). As far as I know, this is the option to use if you want to use the IDE “Debugger.” The line of code will read:

"C:\PROGRA~1\PICC\MACHX.exe" "-T%H" "%D" “2”

Be sure to click on the “Apply” button to save your changes.

There is another MACH-X listing in the table in the “User Defined Tools” window. It is right under the first MACH-X entry and is used with the “Program” button in the “Compile” window. Change the “Command” entry on that line to match the changes you made above. Be sure to click the “Apply” button to save your changes.

Those are the changes that need to be made to successfully use the MACH-X with the CCS C Compiler and its IDE. It seems to have solved my problems.

One more word of caution. If you later want to use one of the other MACH-X programming options you will need to go back into the “User Defined Tools” window and make the necessary changes. There doesn’t seem to be a way to store multiple MACH-X programming options so you can easily switch from one to another.

I hope this is helpful. If you find I have made errors, please post your corrections to the Forum.

Bill Havins
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> CCS ICD / Mach X / Load-n-Go All times are GMT - 6 Hours
Page 1 of 1

 
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