Jump to content

Reynard

EstablishedMember
  • Content Count

    688
  • Joined

  • Last visited

Everything posted by Reynard

  1. In this case should'nt it be x=45? OOps, I see youir point - my mistake I think 0x00 is a perfectly good result. You are shifting in a '0' from the left 8 times not rotating a char 8 times. Cheers Reynard
  2. A tick appears to be an oscillator cycle. If you step through a 1 cycle instruction it will increment the tick count by 4. A 4MHz xtal will give 1us instruction cycle time. The tick count will change to values in 'kilo' after a while i.e. 10k etc. which cannot be reset to zero. If you install BoostC within MPLab (Microchip IDE) you can use its watchdog feature measure in real time. Cheers Reynard Doh! Did I say watchdog feature ? read that as "Stopwatch feature to measure in real time." Reynard
  3. A tick appears to be an oscillator cycle. If you step through a 1 cycle instruction it will increment the tick count by 4. A 4MHz xtal will give 1us instruction cycle time. The tick count will change to values in 'kilo' after a while i.e. 10k etc. which cannot be reset to zero. If you install BoostC within MPLab (Microchip IDE) you can use its watchdog feature measure in real time. Cheers Reynard
  4. You don't say what PIC type you are using. Is the input C12IN0- (C1CH bits = 00) on pin RA1 and not RA0 ? Cheers Reynard
  5. As you said it appears that BoostC does not like initialising structures like other compilers. You will have to fill your structure the hard way. BoostC is still value for money and is still growing. Cheers Reynard ps. MikroC works but you have to pay more.
  6. The answer to that is yes, looks like the IDE version number didn't get updated Regards Dave Can't win them all. It is after all only a Release Cantidate and may be changed. Cheers Reynard
  7. It would be a nice feature to have an option or pragma to force the use of 8 bit pointers. Most of the smaller PIC's only have 256 or less RAM bytes so using 16 bit pointers and switching of IRP bit just adds alot of surplus code. I will refrain form saying that the CCS compiler does it. Doh! just said it. Cheers Reynard
  8. The code below gives errors: CaseTest.c(13): error: missing right brace CaseTest.c(10): error: missing semicolon CaseTest.c(10): error: failure It appears that the case statement constant does not like having the left shift operator in it. (It may not like the right shift operator either but have not tried it.) Replacing the I2C_STATE_1 definition with (0x09) works OK. #include <system.h> #define SSPSTAT_MASK (1 << D_A | 1 << S | 1 << R_W | 1 << BF) #define I2C_STATE_1 (1 << S | 1 << BF) // I2C write, last byte an address. v
  9. Rignt shifting an unsigned long right 4 or more bits, except multiples of 8 , creates 12 redundant program words to the assembler code at beginning of the statement. #include <system.h> unsigned long mylong; void main(void) { mylong = 0x12345678; 0003 3078 MOVLW 0x78 0004 1283 BCF STATUS, RP0 0005 1303 BCF STATUS, RP1 0006 00A0 MOVWF gbl_mylong 0007 3056 MOVLW 0x56 0008 00A1 MOVWF gbl_mylong+D'1' 0009 3034 MOVLW 0x34 000A 00A2 MOVWF gbl_mylong+D'2' 000B 3012 MOVLW 0x12 000C 00A3 MOVWF gbl_mylong+D'3' mylong >>= 4; 000D 3000 MOVLW 0x00 00
  10. The compiler does not recognise that right shifting by 24 is a multiple of 8 bits. #include <system.h> unsigned long mylong; unsigned char mychars[5]; void main(void) { mylong = 0x12345678; 0003 3078 MOVLW 0x78 0004 1283 BCF STATUS, RP0 0005 1303 BCF STATUS, RP1 0006 00A5 MOVWF gbl_mylong 0007 3056 MOVLW 0x56 0008 00A6 MOVWF gbl_mylong+D'1' 0009 3034 MOVLW 0x34 000A 00A7 MOVWF gbl_mylong+D'2' 000B 3012 MOVLW 0x12 000C 00A8 MOVWF gbl_mylong+D'3' mychars[0] = (unsigned char)(mylong >> 0); 000D 0825 MOVF gbl_mylong, W 000E 00A0 MOVWF gbl_
  11. A static array only initializes (zeroes) the first 2 bytes of the array. Put the array inside a structure though and all bytes are initializes. static unsigned char myArray[4]; static struct { unsigned char myArray[4]; } myStruct; produces assemly instructions: static unsigned char myArray[4]; 0004 1283 BCF STATUS, RP0 0005 1303 BCF STATUS, RP1 0006 01A0 CLRF gbl_11_myArray 0007 01A1 CLRF gbl_11_myArray+D'1' static struct { unsigned char myArray[4]; } myStruct; 0008 01A4 CLRF gbl_11_myStruct 0009 01A5 CLRF gbl_11_myStruct+D'1' 000A 01A6 CL
  12. See no problem here. The code loops around 2 assembly instructions that both belong to the same source code line so there is no opportunity for execution line to advance to any other source code line. That's why it looks like stepping takes forever. Regards, Pavel And there was me thinking it would step through the lines of source code including the for (;. Doh ! Cheers Reynard
  13. Pressing Step Into or Step over causes debugger to run forever after a couple of steps. Program should just loop in single step mode forever for each button press. #include <system.h> unsigned char ucTest; bool bTest; void main(void) { bTest = false; for (; { if (bTest) { ucTest = 1; } } } Also, pressing the reset button (after stopping run forever) does not reset the debug cursor to the first instruction. Using: BoostC & IDE 6.81 Windows XP Pro SP2 PIC16F873A Cheers Reynard
×
×
  • Create New...