Hi Brendan, Do you mean the Mplab C18 can select bank of PIC18F automatically? PLease give some suggestions how to select banks in the PIC18F using C18! Thanks in advance Luke -----Original Message----- From: Brendan Moran [mailto:annirack@SHAW.CA] Sent: Thursday, August 15, 2002 2:27 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: bank switch instructions. -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Deva, If you want to avoid bank switching entirely, you can move to a PIC18F series chip. Incidentally, the 16F84 is now obsolete. If that's what you have available for whatever reason, that's fine, but the 16F628 is a much more powerful controller, with the same instruction set as the 16F84. That said, bank switching can be done in any C compiler that supports inline assembly by using the BCF and BSF instructions. You should be able to use something like: #inline bsf STATUS,RP0 var1++ #inline bcf STATUS,RP1 Now, understand that this is not good code, but it will do in a pinch, just make sure to fix it later. It is not self documenting, and it would be far better if you could use bank switch macros or get the compiler to handle it properly. Speaking of which, doesn't the C compiler handle switches if you overrun the amount of RAM available in one bank? Hope that helps. At 07:48 AM 15/08/2002 +0300, you wrote: > Hi Deva, > Could you explain, please, why you choose PIC16F84? >Why not other PIC? I'm just wondering. > I'll not comment your choice, since I've got a >shut up command, though in polite manner from one >of List's heavy-weight during the discussion beginner's >choice. "Freedom of speech", you know, is as knotty >problem as 16FXX bank switching. > > Mike. Mike, on this list, it is difficult some times to tell the difference between vehemence and anger. Are you certain that it is a "shut up command" and not an "I disagree with you"? For the record, I think that the 18F parts are great, but they're not as available as many of the 16F parts. Note that the OP said that there wasn't enough time to switch to a larger processor. I presume that the OP would use a better one under looser time constraints. Regards, - --Brendan -----BEGIN PGP SIGNATURE----- Version: PGPfreeware 6.5.8 for non-commercial use iQA/AwUBPVtJoAVk8xtQuK+BEQLcZwCgiCRlq4hFKnDwHhgk0nLsXTPB+o0AoOrY aXPbi6J8cFu8z+HHI8qaRKFo =WjwO -----END PGP SIGNATURE----- -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads