Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About JJHawg

  • Rank
  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 am trying to create a Dallas One-Wire communication class and include it in other projects by linking in the lib file instead of copying the source code around. Any ideas will be appreciated. Jim G.
  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 in the "About" box. Also, you mentioned the ctrl+shift+u command... but I don't see it documented anywhere. Are there any other features like these??? ;-) Thanks, Jim Pismo Beach, CA
  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, which corresponds to the tristate control register. I think that 0xfe is the pull-up register, but I am not sure. I hope this helps a little... Jim
  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 know how long this program is, but I suggest printing it out and go over it very carefully, line-by-line. If you are using c++ classes, and/or multiple source files it gets a little more difficult, but the process is the same... BTW: I don't know of anything in the evaluation version that would be causing your problem. P.S. If you want me to look over the code and look for problems you can send it to JJHawg@aol.com P.P.S. You might also try running it through a LINT program... I never use lint, but there must be some freeware out there you could try.
  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 stuff. } if ( (Temp & SWITCH_2) == 0 ) { //Do switch two stuff. } if ( (Temp & SWITCH_3) == 0 ) { //Do switch three stuff. } //Do other stuff... //Wait awhile then do it again... delay_ms(100); } } In real life you may need to consider switch debouncing and other issues, but this shows the main idea. Jim
  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: Possible truncation to 8-bit Warning: The function '___compress' was not called. Code generation skipped Warning: Variable '_c_MinuteTick' is not used. Ram allocation skipped asm error: Non-native Scenix assembler found: ret DEVICE OSC4MHZ, TURBO, OPTIONX, STACKX Finished. Done Failed ---------------------- This is a real error that doesn't create a .asm file. The "asm" operator is nice because you can reference C code variables there. Maybe there could be a "literal_output" operator that just copies its contents to the output file.... ---------------------- Here is something that I just tried, it might be the solution. In my PSX28AC.INC file I added this line: INCLUDE 'Setup.inc' In my project directory I created a Setup.inc file that has the directives I need. The compiler puts the INCLUDE in the output file, and the assembler picks up the actual file. So, this is an acceptable solution, for me anyway... ;-) Thanks looking into this... Jim
  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
  • Create New...