Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About rminnig

  • Rank
  1. Has anyone ever done a downgrade of the BoostC compiler? The reason I ask is because I have a client that wants to make source code changes to a product that is in production since 2007. As far as I can tell from the listing file: ;// Code Generator: BoostC Compiler - http://www.sourceboost.com ;// Version : 6.35 is the version they used, but when I try to compile the source code with 7.10, the listing file is so different that BeyondCompare shows all red for nearly the whole of the compare. What I'm trying to do is verify that the HEX file they use was generated from a specific
  2. What am I doing wrong? I'm using the 16LF819. The generated assembly follows with the original C++ code ;;;;;;commented by the code generator. I've tried two methods, one with testing the bit, one with testing the compliment of the bit. The purpose of this one line of code is to test the state of the GO bit in adcon0, continue to loop if the bit is set, break out of the loop when the bit goes clear (i.e. the hardware clears this bit when AD conversion is complete) ;;;;;;;; while (!(adcon0 & (0x01<<2))) {;} //wait for conversion complete label_0000 movf _adcon0, W
  3. Either way I write the commented line the generated code seems not to work properly. The code should test the 'GO' bi tin ADCON0 and if the bit is not cleared (i.e. AD conversion not complete) then just stay in the while loop. When the bit goes clear then the while statement should fail and jump out fo the loop. What am I doing wrong. I've included the generated assembly code, the original source code line is ;;;;;;;;;commented. ;;;;;;;; while (!(adcon0 & (0x01<<2))) {;} //wait for conversion complete label_0000 movf _adcon0, W andlw D'4' btfss STATUS, Z goto lab
  4. Remember mechanical switches require a debounce or you will see many "button transisitons" if you are just looking at the edges. Here is my code, subsitute any port or pin within that port into the initial if statement. This code assumes that the system is providing a periodic 'tick' to the tick method. You can also do this with a timer if you wish. cpp file: #include "PushButton.h" #include "p16f818.h" // Constructs a Task object. CPushButton::CPushButton() { bButtonPressed = false; bButtonHeld = false; chButtonIterations = 0; } void CPushButton::tick(void) { c
  5. Can you either post or email me the generated assembler file? That should give a clue as to what the processor is doing with the pins on port b and timing.
  6. There is a serious code generation error with the C2C++ compiler. Note the generated assebly snippet: ... _adresl equ 0x9e ;1 _adcon1 equ 0x9f ;1 _eedata equ 0x10c ;1 _eeadr equ 0x10d ;1 _eedath equ 0x10e ;1 _eeadrh equ 0x10f ;1 _eecon1 equ 0x18c ;1 _eecon2 equ 0x18d ;1 _this_tick_CPWM_00 equ 0xffffffff ;2 ORG 0 goto start__code ORG 4 ;;;;;;;; ;;;;;;;
  7. Why does this work? #define bool char #define false 0 #define true 1 bool b8HzModulation = false; b8HzModulationIsOn ^= true; //toggle and this doesn't? #define bool char #define false 0 #define true 1 bool b8HzModulation = false; b8HzModulationIsOn ~= b8HzModulationIsOn; // should toggle, but doesn't In the example "osExample.cpp" I see the statement which I presume works: m_ledState = ~m_ledState; -Any Ideas?
  8. You cannot use the example you have exactly. I don't know if the standard string library is included in C2C(++), but if it is you can use something like this: char pch1[5] = "hi"; char pch2[5]; //presumably, something in this array if (strcmp (pch1, pch2)) { //do something useful } If the string library is not included you should be able to find source code for it on the net somewhere. Not like it's all that original or secretive code anyway. Hope this helps. -Ryan
  9. You mean, this is ALMOST absolutely correct. Some of the 18 series parts, i.e. the 18F452 allow reading of IDLOCS during normal execution through the TBLRD and TBLWT assembly instructions. Most other parts do not allow acces during normal execution, check with the data sheets for the part you are working with. Check out the data sheets from the microchip website, DS39564B.pdf (Datasheet for the 18FXX2).
  10. I would suggest posting your code so we can help you learn what might be wrong with it.
  11. You can not have 2 different ISRs on this chip. The 18 series chips hava a high priority and low priority interrupt that can have 2 different vectors. With 1 ISR you can do something like this: void interrupt( void ) { if ( //check to see if souce was timer 0) { } else if ( //check to se if source was RBIF) { } else if ( //check to see if source was INTF) { } else //it was a false alarm, or no code implemented } and you can order your if-else statemtns in the priority that you want to check. -Ryan
  12. Why do you need those variables at a specific address? You can also try using a union: union { short s; char ch[2]; }u; Then access the varibles like this: u.s = 12345; char var1 = u.ch[0]; char var2 = u.ch[1]; Hope this helps.
  13. The following code whould compile just fine, but gives me a stupid error every time. This exact same code compiles with the MSVC++ v6 SP5 compiler. enum eLEDPort { LED_ON_PORTA = 0x01, LED_ON_PORTB }; I've ended up using a work around: //enum eLEDPort //{ #define eLEDPort char #define LED_ON_PORTA 0x01 #define LED_ON_PORTB 0x02 //}; Why doesn't the first code example compile? I get error: LED.h(38): '(' expected The enum statement is on line 38 in the header file.
  • Create New...