Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by TomF

  1. Hi- Tried to use a member of a struct as an index into a string array. It doesnt work. See below; struct sTimeDate { unsigned char day; unsigned char month; unsigned char year; unsigned char hours; unsigned char mins; unsigned char secs; }; void TransmitTimeDate(bool bTxTime, bool bTxDate, struct sTimeDate* ptd) { char* pszMonths[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; unsigned char nMonth = ptd->month -1; COMMS_TransmitText( pszMonths[nMonth] ); // OK // COMMS_TransmitText( pszMonths[(ptd->month)-1] ); // doesnt work }
  2. The list appears to be a list of targets that can be selected to compile code, not a list that can be simulated.
  3. Hi- Is there a list anywhere of what targets are supported my the simulator and what are the limitations of each target? E.g. - 12Fxxx not supported - 16F636 has RA3 and RA4 swapped etc.. I'm starting loads of new projects next year and want to us the simulator more to save costs, so i need to know what devices are supported, and what that support is.
  4. bump. This needs to be fixed, or at least acknowledged.
  5. Hi. Trying to simulate the 16F636, however i cannot write to RA4, I can read RA4. I can read and write RA3, which is the MCLR pin, which is supposed to be read only. So, i think the simulator has RA3 and RA4 mixed up. Can this be fixed quite quickly? I really need to simulate the software this week. Sourceboost 'c' compiler, V7.04 - Edit: The sleep appears to not cause the device to sleep, or the WDT is expiring immediately and wakening the device from sleep.
  6. Open an existing project. Change a source file so it has not been saved. Close the application -> "save changes? YES NO CANCEL" pops up Click "cancel" (which means don't close the app) The app closes and doesn't save the file (same as clicking "no")
  7. Hi, Are the following 4 statements true for a device that implements 'lata' and 'porta', rather than only 'porta' 1. Write to LAT (which then gets written to PORT) 2. Read from LAT if pin is output (read what you set in 1. above) 3. Read from PORT if pin is an input (read input from external hardware) 4. Reading from LAT when pin is an input always reads as '0' ?
  8. Hello, After a compile, the memory used by ide.exe as shown in task manager increases, after each compile, the memory gets larger and larger. If i use the program for 3 days without closing it, the toolbar button icons disappear. restarting the app fixes the issue. Also, during my normal days work, maximising and minimising the application, and other applications, the toolbars at the top reset to their default position (stacked vertically on the left). V7.03
  9. OK, so can function info be shown when out of memory error is shown?
  10. Hi, Pressing the Build button doesnt compile then link. I have to press compile then link each time. I have the build options set to compile, link. Building... error: could not open input file makefile.GC864 Done
  11. Hi, My pic is now out of memory, so i need to optomise some functions which are using loads of code space. (my program is text string heavy, so its using all the code space!) However, the codebar -> function info tab is empty, which is really not very helpful. Can this be changed to show function info even if out of memory? This would be a great help.
  12. Hi, Yes that works, i programmed he device, then read back the eeprom and it is correct. How strange. Any idea why MPLAB ignores the correct address? Where did 0xf000 come from?
  13. SB7 isnt changing the configuration bits based on the debug/release dropdown menu. The debug configuration bit is not defined the the chips header file. You need to change the bit in the #pragma because its missing from the header file. (see dave's reply, ^^above)
  14. hi, I have used #pragma DATA _EEPROM, 99, 99, 99 successfully on a 12F device, but im now using a 16F1827, and MPLAB appears to not reconise the eeprom data? Can someone that knows hex files have a look to check this feature is working ? Thanks!
  15. BUMP! Any chance of an acknowledgement and a timeframe to fix the find issues? I was hoping that it would have been done in V7.03 I use Find (F3) and coded folding all the time, and the 2 features just do not work together. Its extreamly anoying having to open a source code file into textpad to do find operations because in SB if any functions in the file your searching within is folded, the find fails, and there is no "unfold all" option that i can find.
  16. Thanks for the replys. Im clocking SPI as fast as possible with the 18MHz xtal im using; this may cause transmission line issues? not sure, the traces are as short as possible. I cant use the internal SPI because i also needed a uart and a xtal, which is on the same pins
  17. Hi Guys, The find dialog doesnt work correctly - here are a few bugs ive found with it: If the code is closed (e.g. just the function name showing in the editor), the find doesnt scroll the window to the found text. The "match at word start" does nothing. If i search for g_ it matches debug_text and g_variable. Find/replace, 'Find Next': when clicking find next, the operation doesnt scroll the window to the text it is highlighting, which means i cant see what it is highlighting? This is probably related to the code closed issue, above. Wanted: Find in files: Can the default find location be the current project please? That would be useful. Also, can there be a filter for *.c and *.h files? This would also be nice when adding files to project, e.g. add *.c or *.h files, rather than having to uses *.* and seach for the file. Thanks.
  18. Thank you both for the answers. Im not using the port as an input, the outputs on b7 and b6 are driving a clock and data line for a SPI device, so its not a big load. Its running at full speed, e.g. im changing the port data as fast as the pic can do it, so wondering if the next instruction is being read before the line fully changes state (low to high).
  19. Hi, Im using 16F1827 at 18.432MHz HS xtal. The device is setup correctly and all periferals are turned off. set_bit(portb, 6); set_bit(portb, 7); clear_bit(portb, 6); clear_bit(portb, 7); If i do this, the port lines act strangely, its hard to exactly describe what happens, but RB6 appears to drive correctly until RB7 is set, then it follows RB7 for a small period of time, then returns to where it should be. Adding a NOP instruction between the set_bit calls fixes the issue. However, if i do the following, it works as expected. Does anyone care to explain why, i dont understand it!? set_bit(latb, 6); set_bit(latb, 7); clear_bit(latb, 6); clear_bit(latb, 7); If i write this, it also works as expected: portb = 0b01000000; portb = 0b11000000; portb = 0b10000000; portb = 0b00000000; ? totally confused with this.
  20. Hi Dave. the lines: #ifndef __COMMS_H__ #define __COMMS_H__ i thought were to stop a new instance being created when included, and the static keyword on a variable means private to the module? If thats the case, then creating a copy is incorrect and the compiler should complain that it cannot find the variable (becuase its static). Im not usre what other compilers do as i dont have time to try this in HiTide Im still not convinced that by including something you are creating a new instance, you are simply making the code visable to the file that included it, right? <confused>
  21. Thanks for the reply. Thats actually quite a good idea! I'll do that.
  22. Thanks for that, yes, that worked. I hate global vars, and as you can see, i dont ever use them, but this time, i have to! If the static keyword hides the variable, why does the compiler not complain that g_Count is undefined in main.c? Instead, the compiler creates a random variable and uses it.
  23. Hi Pavel, Thats not what i want. I would like a global variable, e.g. only one variable, not 2 variables. Multiple sources need to access ONE variable. What am i doing wrong?
  24. Ah ha! the compiler is creating 2 different variables for g_Count, see this assembly codee: gbl_13_g_Count EQU 0x00000020; bytes:1 gbl_14_g_Count EQU 0x00000021; bytes:1 : : ORG 0x0000000C not_local_00000 ; { not_local; function begin MOVLW 0x04 MOVLB 0x00 MOVWF gbl_14_g_Count MOVLB 0x01 BSF gbl_pie1,4 label2 MOVLB 0x00 MOVF gbl_14_g_Count, F BTFSC STATUS,Z RETURN MOVLW 0x01 XORWF gbl_portb, F MOVLW 0x64 MOVWF delay_us_00000_arg_del CALL delay_us_00000 GOTO label2 ; } not_local function end ORG 0x0000001B local_00000 ; { local; function begin MOVLW 0x04 MOVLB 0x00 MOVWF gbl_13_g_Count MOVLB 0x01 BSF gbl_pie1,4 label3 MOVLB 0x00 MOVF gbl_13_g_Count, F BTFSC STATUS,Z RETURN MOVLW 0x01 XORWF gbl_portb, F MOVLW 0x64 MOVWF delay_us_00000_arg_del CALL delay_us_00000 GOTO label3 ; } local function end local() operates on 'gbl_13_g_Count', whereas 'not_local()' operates on 'gbl_14_g_Count' Im totally confused.
  25. Hi, In main.c and comms.c i have 2 functions that contain the exact same code. The functions are called "local()" in main.c, and "not_local" in comms.c The code here sets a global var 'g_count' defined in comms.h to 4, then enables interrupts that decrement the variable until it reaches zero. local() and not_local() wait for the variable to reach zero and return. not_local() never returns, which is strange. main.c #include <system.h> #include "comms.h" // // DEVICE: PIC16F1826 // WDT: Off. // #pragma CLOCK_FREQ 18432000 // 18.432 MHz #pragma DATA _CONFIG1, _FOSC_HS & _WDTE_OFF & _PWRTE_ON & _MCLRE_OFF & _CP_ON & _CPD_OFF & _BOREN_ON & _CLKOUTEN_OFF & _IESO_OFF & _FCMEN_OFF #pragma DATA _CONFIG2, _WRT_ALL & _PLLEN_OFF & _STVREN_ON & _BORV_25 & _LVP_OFF void local() { g_Count = 4; set_bit(pie1, TXIE); while(g_Count) { toggle_bit(portb, 0); delay_us(100); } } void interrupt() { if( test_bit(pie1, TXIE) && test_bit(pir1, TXIF) ) { if( g_Count ) { g_Count--; } if( !g_Count ) { clear_bit(pie1, TXIE); } } } void Init() { porta = 0b00100011; trisa = 0b11100100; portb = 0b00000000; trisb = 0b00100010; ansela = 0; // Digital IO anselb = 0; // Digital IO wpua = 0; wpub = 0; // Config serial port. clear_bit(txsta, SYNC); // Choose async comms. set_bit(rcsta, SPEN); // Enable serial port (this doesnt turn on transmitter) set_bit(intcon, PEIE); // Enable periferal interrupts for serial port. set_bit(txsta, TXEN); // Enable the transmitter (will interrupt at once). pir1 = 0x00; // Clear all periferial pending interrupts. set_bit(intcon, GIE); // Globally enable interrupts. set_bit(txsta, BRGH); // Use 8-bit high-speed baud rates. spbrgl = 19; // 57600 } void main() { Init(); for(;;) { local(); not_local(); } } comms.h #ifndef __COMMS_H__ #define __COMMS_H__ static volatile unsigned char g_Count; void not_local(); #endif comms.c #include <system.h> #include "comms.h" void not_local() { g_Count = 4; set_bit(pie1, TXIE); // This while loop never exits. while(g_Count) { toggle_bit(portb, 0); delay_us(100); } } Any ideas why this happens? Is it a compiler bug?
  • Create New...