Jump to content

JJHawg

EstablishedMember
  • Content Count

    21
  • Joined

  • Last visited

Everything posted by JJHawg

  1. I am trying to have the methods of a statically declared object assemble at a certain address, to avoid crossing page boundries, and nothing I try works. Can this be done? Thanks, Jim
  2. I found out that the compiled code doesn't always work when it wraps a page boundry, so I used the "func() @ 0x200" to start the compiling in another page. My question is, "how do I know the order of file compiling so I can do this efficiently?" Also, it there a way to set the page for the built-in library code, like the "delay_xx()" functions? Thanks, Jim
  3. I am having problems with the compiler not creating "bank" instruction when it should. The problem occurs when I use up all the global registers with my own hard-addressed variables. The compiler does not include a "bank" instruction before it uses the "_code_tempxxx" variables. I don't always need to use up all of the global registers for my own variables, but shouldn't the compiler figure this out? Thanks, Jim
  4. Has anyone actually sucessfully created a .lib file using any of these compilers? I recall seeing some posts about it here a few years ago, but nothing since. I have tried doing it from the IDE, and command line with no success. When I try to include the new lib file in a project it complains about it being corrupt. One potential problem with creating a library file is that none of the code in the source file is actually called by anything, and it might optimized out. Of course, if you turn on the flag to keep code that isn't used, you get a ton of stuff that isn't needed. I
  5. Thanks for the quick reply... I tried this again today with the same results: Create a folder for testing, and copy a .cpp (or other) file into it. From the "Edit" menu, select "Replace in Files" On the dialog: Look in: Browse to the desired directory For files named: *.* Set the find/replace strings as desired. When I click "Replace", everything is turned upper case, except my particular replace string, which happened to be lower case. I just tried it again with another file (*.h) with the same results. Like I said before, the is version 5.8 as stated i
  6. I am using SourceBoost IDE 5.8, and just used "Replace in Files", and was a little "surprised" to find that in the file where my replace string was found, all of the text was converted to UPPER CASE. I tried this in another small test file and it seems to be repeatable. Otherwise, I am having pretty good luck with the IDE. Got to go now and retype 200+ lines... Thanks.
  7. Hi there. I don't have time for the long version right now, but I suspect that your difficulty is caused by not using the Mode register properly. Here is how I set the tristate mode (direction) for port B asm mov m, 0xff asm mov !RB, _TrisImage Moving the 0xff into "m", mode register, directs the mov !Rx instruction to the tristate control register. You set the mode register to different values depending upon which control register you want the mov !Rx instruction to modify. Check the SX datasheet for details. The default value of the mode register is 0xff
  8. Here is one approach that popped into my head. I have tested a few values with it, but can't guarentee that it will work in all cases... The only time that the sum will be less than either (both?) of the source operands will be if there is an overflow. So, here is one way you might code it: short temp_sum; temp_sum = shortA + shortB; if ( (temp_sum < shortA) || (temp_sum < shortB) ) { shortA++; } See what happens... ;-) Jim
  9. It would be helpful to see the context of this code; what you are really trying to accomplish. ... The value of a 16 bit integer can never be greater than 0xffff ... Jim
  10. I have encountered problems similar to the one you describe, and it usually turned out that the problem was really somewhere before the indicated error line. That is why commenting lines simply moves the indicated error line. The compiler reports the error where it does because it is the first place that it _notices_ the error, not always on the line that is actually causing the error. Usually it is some difficult-to-find, silly mistake that I made. One place to look is inside any "asm{}" blocks that you have. I have sometimes had syntax problems inside these. I don't k
  11. You have to read the entire port, then isolate the pins you care about; for instance: char gpio @ 0x05 char SwitchPort @ 0x05 //different name for same port... //Set up bit masks for the inputs. #define SWITCH_1 0x01 #define SWITCH_2 0x02 #define SWITCH_3 0x04 void main(void) { char Temp; while(1) { //Grab a snapshot of the port. Temp = SwitchPort; //This assumes that the internal pull-up resistors //are turned on and the switches go to ground. if ( (Temp & SWITCH_1) == 0 ) { //Do switch one stuf
  12. I have not used the chip you mention, but your problem may be as simple as creating your own variables that represent the port, like: char gpio @ 0x05; //gpio port char trisio @ 0x85; //gpio i/o select char wpu @ 0x95; //gpio weak pull-up select void main(void) { char x; x = gpio; //read the port } Give this a try, hopefully it will help. Jim
  13. Thanks for the reply... When I compile a program with the directives as shown above, I get the following output: Compiling... C:\PROGRA~1\PicAnt\c2cpp.exe -PSX28AC -SRC -ols -md -O0 -W2 -IC:\PROGRA~1\PicAnt\Include\pSX28AC.inc -oC:\PROGRA~1\PicAnt\Projects\DUALCH~1\DualChannel.asm ROTARY~1.CPP System.cpp Zone.cpp DUALCH~1.CPP C2C++ 5.1e C/C++ compiler Copyright© 1998-99,2000-2003 by Pavel Baranov support@picant.com (Extended version) Licensed to: Jim Greenhaw ROTARY~1.CPP System.cpp Zone.cpp DUALCH~1.CPP C:\PROGRA~1\PicAnt\Lib\cppSX.lib Warning in a library
  14. Thanks for the reply. I have tried something like what you suggest, but I think the assembler built into the IDE gets upset because it doesn't recognize the codes. The nice thing about using the .inc file is that the built in assembler doesn't look at it. I am using the latest SXKey program that wants these directives: asm { DEVICE OSC4MHZ, TURBO, OPTIONX, STACKX FREQ 4_000_000 IRC_CAL IRC_4MHZ } Any hints you can provide will be appreciated. Jim
  15. This reply is a little late, but it may help someone else... I had this same problem, even with all the latest and greatest stuff, because I didn't install the plugins in the same directory as PicAnt.exe. When I installed them in the correct directory everything was fine. Jim
  16. I use different assembler directives for each project I am working on. However, it seems that PicAnt always selects the include file according to the target selected, even if I manually change it for a given project. The bottom line is that I would like some way to set assembler directives (DEVICE, FREQ, IRC_CAL, etc) for each project. It can be from inside the cpp code or an include file, either way would be fine. If there is already a way to do this, please advise. Thanks... BTW: I am liking the new version...
  17. I recently downloaded the version 5.1 and it looks great. However, I have a couple of lingering questions about using it with the SX. 1. I don't see any Wizard support for the SX. I don't rely heavily on the Wizard, but it would be nice for the SX. (Yes, I know *I* could make my own templates, but you are the expert... ;-) 2. I am having a little trouble figuring out how to use the I/O port special mode register. For instance, to set the data direction I can use the set_trisa_a() function (macro?). However, the help page says that this function is obsolet
  18. This has been a minor annoyance since day-one... The workaround is to type anything, like /**/, then hit the <home> key. Once the editor has any characters *after* the cursor, it works just fine. Jim
  19. Here is my $0.02... The "!" operator is used to invert the results of a logical operation, like ... if ( x != 55 ). The result of using "!" is either false (0x00), or true (0x01). To invert the individual bits in a bit-mask, like your example, you would use the "~" operator... gpio &= ~LE; I hope this helps. Jim
  20. Here is my (hopefully) brief opinion... For all practical purposes C++ is just an extension of C. So, if you learn C++ you are also learning C. If you already program in some language you might have to "unlearn" a couple of things to understand some of the C++ stuff. Plain C, however, is just like any other structured lanuage you might have encountered. C++ mystified me for years until I started digging into the code generated by the compiler and could see that it just isn't that complicated... but it did take some digging. I don't write tons of embedded apps, but so far I
  21. Thanks for the informative reply... I set things up as you recommend, but it still doesn't work. I think the lib file is being generated correctly, but I have trouble using it. There are a couple of things to note: With the older version of the compiler there was an option setting to include lib files in the build. The new PicAnt IDE doesn't have this, so I added the lib file to the project. When I compile the main project I get the following in the build dialog: UARTST~1.CPP DALLAS~1.LIB This is not a library file or it is corrupted (DALLAS~1.LIB) Done I
×
×
  • Create New...