Jump to content

AudiTTR

EstablishedMember
  • Content Count

    11
  • Joined

  • Last visited

Community Reputation

0 Neutral

About AudiTTR

  • Rank
    Newbrie

Contact Methods

  • Website URL
    http://
  • ICQ
    0

Profile Information

  • Location
    Sydney, Australia
  1. Hi Yannux, I'm not sure which PIC MCU you're trying to program, and I've not had any experience with RS-232, so I might be completely off-track. However, with that said, in my experience when you are working PIC MCUs you need to set the relevant interrupt enable (IE) bit before any test the corresponding interrupt flag (IF) bit. Therefore, in your case, my suggestion would be to check whether your MCU has a TXIE bit in something like the PIE1 register. If it does, then use this bit to either enable or disable the TX interrupt. So, you may need to set the TXIE bit before you enter into your while loop. For example: set_bit(pie1, TXIE); while(1) { while (!test_bit(pir1, TXIF)); txreg = 0x31; } Another thing to consider is whether your MCU has a "Global Interrupt Enable" (GIE) bit in something like the INTCON register. If it does then you would need to set this bit too before you set the TXIE bit in order to enable all interrupts on your MCU. Something like this may work: set_bit(intcon, GIE); set_bit(pie1, TXIE); while(1) { while (!test_bit(pir1, TXIF)); txreg = 0x31; } However, check the Microchip datasheet for your MCU, in particular the section on Interrupts and the UART (or EUSART). ...AudiTTR
  2. Bug description: I get the following error when trying to compile code that contains the following typedef syntax: typedef char Buffer[8]; Steps to reproduce: Compile the following code: #include <system.h> void main() { typedef char Buffer[8]; Buffer buffer1; buffer1[0] = 0x01; buffer1[1] = 0x02; } is reported by the compiler on the typedef statement at line #5. Expected behaviour: As per the ANSI C standard, in this example a type called Buffer should be created, which is actually an alias for an array of 8 bytes. The Buffer type can then be used to declare variables, which act in the same manner as though they were directly declared as an array of 8 bytes (see example code above). Is the problem 100% reproduceable: 100% reproduceable, happens every single time. IDE version: v6.40 Compiler: BoostC Compiler version: v6.40 Target device: PIC18F4550 OS: Windows XP SP2
  3. That wouldn't be valid C anymore, plus it doesn't make any difference to the error message - i.e. I still get: if I remove the semicolon from the end of the typedef statement. Any other ideas / suggestions? Thanks
  4. Hi Dave, Yes, I know that you can do it this way, its just tedious if you've got a lot of these vars, and a right pain if you decide to later change the size of each var, plus you have to manually calculate the start address of each var. Can't the compiler do this automatically for you (after all its pretty simple math for a computer to work this out at compile time)? Is there no other way to specify the start address for a block of vars (or even a block of code)? Thanks
  5. Hi everyone, Is it possible to specify the starting memory location in which to store a block or group of variables in the BoostC compiler? For example, in the MPLAB C18 compiler you can specify that following group of variables start at a particular memory location: #pragma udata usbram4=0x0400 volatile char buffer1[4]; // buffer1 starts at: 0x0400 volatile char buffer2[4]; // buffer2 starts at: 0x0404 volatile char buffer3[8]; // buffer3 starts at: 0x0408 volatile char buffer4[8]; // buffer4 starts at: 0x0410 // etc., etc. #pragma udata // return to normal memory address for the next variable I know that in BoostC you can use the var@<addr> notation to position individual variables at a specific memory address, but, can you do it for a group of variables as in the above example? Thanks.
  6. Hi everyone, I'm trying to create a new type definition for a buffer. For example: typedef char Buffer[8]; Buffer buffer1; buffer1[0] = 0x01; buffer1[1] = 0x02; However, when I try to compile this simple code using the BoostC compiler in the BoostIDE, I get the following error on the typedef line: As far as I know, this is valid ANSI C syntax. Does anyone know what I'm doing wrong? Is this syntax not supported with the BoostC compiler? If so, is there another way around this without using the obvious declaration: char buffer1[8]; Thanks
  7. The same - except with the Extended Linear Address Record added to first line of the hex file. Seems to work OK. Now to try some more complicated code. Thanks for all your help Dave - much appreciated.
  8. Hi Dave, Download speed wouldn't be a problem as this Demo board is programmed via Full Speed USB & not RS-232. It would be great if there was a tick-box somewhere in the SourceBoost IDE Options that allowed developers to specify whether BoostC generated the Extended Linear Address Record as part of the hex file (the default setting would be off so that it didn't mess up most people's programmers). Thanks for the tip regarding the "P" button. What I have done is add the following value to the Programmer field in the BoostC Compiler Options - Tools dialog: C:\Program Files\Microchip\MPASM Suite\MPAsmWin.exe /q /p18F4550 "%name%.asm" /l"%name%.lst" /e"%name%.err" Now after I do a successful Build, I can press the "P" button to invoke the MPASM assembler to re-assemble the BoostC ASM file which will overwrite the BoostC HEX file with the one generated by MPASM. Its a dodgy workaround, but, it seems to work OK.
  9. Hi Dave, How would I go about do this? I am only using the Free version of BoostC at this stage. My development environment consists of: SourceBoost IDE v6.40 MPLAB IDE v7.31 PICDEM FS USB Demo Board PICDEM FS USB Demo Tool v1.00 (for uploading code/programming the Demo Board) Note: I have not installed the MPLAB C18 Compiler as I wanted to try BoostC first. I note that the SourceBoost web-site states that the SourceBoost IDE supports: However, I cannot find any option that lets me specify an alternative assembler, such as MPASM.
  10. Thanks for the link to the explain the Intel Hex file format. I wonder why MPASM adds the first line (the Extended Linear Address Record line) to the hex file, whereas the SourceBoost IDE doesn't. To confirm that this is the cause of the problem, I simply copied ":020000040000FA" from the MPASM hex file and inserted it into the BoostC hex file at the start of the file. After doing this I was able to successfully upload the hex file onto the PICDEM board and run the app. Does anyone know of a way to make the SourceBoost IDE use the MPASM assembler instead of its own so that I can get around this problem? I am using SourceBoost IDE v6.40.
  11. Hi everyone, I'm a PIC and SourceBoost newbie so this might be a silly question... I have a PICDEM FS USB demo board with a PIC18F4550 MCU and I'm trying to get a simple BoostC program to work that increments an 8-bit counter every 1 sec and displays the current counter value on 8 LEDs (PORTD). I have built the C program using the SourceBoost IDE and everything seems to work OK - debugs OK too. However, when I try to load the HEX file onto the PICDEM FS USB demo board and run it - nothing happens. It seems the format of the HEX file is slightly different formats than the HEX files that are produced from MPASM. Note: I am using the -rb BoostLinker option to relocate the start of the code (& interrupts) to 0x0800 to avoid overwriting the std. USB Boot Loader that is include with the PICDEM board. The reason why I suspect the HEX file is in a different format is that I can take the exact ASM file that is produced by the Boost IDE for the C app, load it into MPLAB IDE, build the ASM code into a HEX file (using MPASM) and then upload the HEX code into PICDEM board and bingo everything works OK. If I then take the HEX file that was produced by BoostC and upload it into the PICDEM board - nothing happens. Has anyone had a similar experience to this? If so how did you solve it? I have attached the ASM file plus the 2 HEX files as reference: ASM file produced by BoostC: ;///////////////////////////////////////////////////////////////////////////////// ;// Code Generator: BoostC Compiler - http://www.sourceboost.com ;// Version : 6.40 ;// License Type : Lite License (Unregistered) ;// Limitations : PIC18 max code size:8192 bytes, max RAM banks:2, Non commercial use only ;///////////////////////////////////////////////////////////////////////////////// include "P18F4550.inc" __HEAPSTART EQU 0x0000000B; Start address of heap __HEAPEND EQU 0x000001FF; End address of heap gbl_status EQU 0x00000FD8; bytes:1 gbl_prodl EQU 0x00000FF3; bytes:1 gbl_prodh EQU 0x00000FF4; bytes:1 gbl_sppdata EQU 0x00000F62; bytes:1 gbl_sppcfg EQU 0x00000F63; bytes:1 gbl_sppeps EQU 0x00000F64; bytes:1 gbl_sppcon EQU 0x00000F65; bytes:1 gbl_ufrm EQU 0x00000F66; bytes:1 gbl_ufrml EQU 0x00000F66; bytes:1 gbl_ufrmh EQU 0x00000F67; bytes:1 gbl_uir EQU 0x00000F68; bytes:1 gbl_uie EQU 0x00000F69; bytes:1 gbl_ueir EQU 0x00000F6A; bytes:1 gbl_ueie EQU 0x00000F6B; bytes:1 gbl_ustat EQU 0x00000F6C; bytes:1 gbl_ucon EQU 0x00000F6D; bytes:1 gbl_uaddr EQU 0x00000F6E; bytes:1 gbl_ucfg EQU 0x00000F6F; bytes:1 gbl_uep0 EQU 0x00000F70; bytes:1 gbl_uep1 EQU 0x00000F71; bytes:1 gbl_uep2 EQU 0x00000F72; bytes:1 gbl_uep3 EQU 0x00000F73; bytes:1 gbl_uep4 EQU 0x00000F74; bytes:1 gbl_uep5 EQU 0x00000F75; bytes:1 gbl_uep6 EQU 0x00000F76; bytes:1 gbl_uep7 EQU 0x00000F77; bytes:1 gbl_uep8 EQU 0x00000F78; bytes:1 gbl_uep9 EQU 0x00000F79; bytes:1 gbl_uep10 EQU 0x00000F7A; bytes:1 gbl_uep11 EQU 0x00000F7B; bytes:1 gbl_uep12 EQU 0x00000F7C; bytes:1 gbl_uep13 EQU 0x00000F7D; bytes:1 gbl_uep14 EQU 0x00000F7E; bytes:1 gbl_uep15 EQU 0x00000F7F; bytes:1 gbl_porta EQU 0x00000F80; bytes:1 gbl_portb EQU 0x00000F81; bytes:1 gbl_portc EQU 0x00000F82; bytes:1 gbl_portd EQU 0x00000F83; bytes:1 gbl_porte EQU 0x00000F84; bytes:1 gbl_lata EQU 0x00000F89; bytes:1 gbl_latb EQU 0x00000F8A; bytes:1 gbl_latc EQU 0x00000F8B; bytes:1 gbl_latd EQU 0x00000F8C; bytes:1 gbl_late EQU 0x00000F8D; bytes:1 gbl_ddra EQU 0x00000F92; bytes:1 gbl_trisa EQU 0x00000F92; bytes:1 gbl_ddrb EQU 0x00000F93; bytes:1 gbl_trisb EQU 0x00000F93; bytes:1 gbl_ddrc EQU 0x00000F94; bytes:1 gbl_trisc EQU 0x00000F94; bytes:1 gbl_ddrd EQU 0x00000F95; bytes:1 gbl_trisd EQU 0x00000F95; bytes:1 gbl_ddre EQU 0x00000F96; bytes:1 gbl_trise EQU 0x00000F96; bytes:1 gbl_osctune EQU 0x00000F9B; bytes:1 gbl_pie1 EQU 0x00000F9D; bytes:1 gbl_pir1 EQU 0x00000F9E; bytes:1 gbl_ipr1 EQU 0x00000F9F; bytes:1 gbl_pie2 EQU 0x00000FA0; bytes:1 gbl_pir2 EQU 0x00000FA1; bytes:1 gbl_ipr2 EQU 0x00000FA2; bytes:1 gbl_eecon1 EQU 0x00000FA6; bytes:1 gbl_eecon2 EQU 0x00000FA7; bytes:1 gbl_eedata EQU 0x00000FA8; bytes:1 gbl_eeadr EQU 0x00000FA9; bytes:1 gbl_rcsta EQU 0x00000FAB; bytes:1 gbl_txsta EQU 0x00000FAC; bytes:1 gbl_txreg EQU 0x00000FAD; bytes:1 gbl_rcreg EQU 0x00000FAE; bytes:1 gbl_spbrg EQU 0x00000FAF; bytes:1 gbl_spbrgh EQU 0x00000FB0; bytes:1 gbl_t3con EQU 0x00000FB1; bytes:1 gbl_tmr3l EQU 0x00000FB2; bytes:1 gbl_tmr3h EQU 0x00000FB3; bytes:1 gbl_cmcon EQU 0x00000FB4; bytes:1 gbl_cvrcon EQU 0x00000FB5; bytes:1 gbl_ccp1as EQU 0x00000FB6; bytes:1 gbl_eccp1as EQU 0x00000FB6; bytes:1 gbl_ccp1del EQU 0x00000FB7; bytes:1 gbl_eccp1del EQU 0x00000FB7; bytes:1 gbl_baudcon EQU 0x00000FB8; bytes:1 gbl_ccp2con EQU 0x00000FBA; bytes:1 gbl_ccpr2 EQU 0x00000FBB; bytes:1 gbl_ccpr2l EQU 0x00000FBB; bytes:1 gbl_ccpr2h EQU 0x00000FBC; bytes:1 gbl_ccp1con EQU 0x00000FBD; bytes:1 gbl_eccp1con EQU 0x00000FBD; bytes:1 gbl_ccpr1 EQU 0x00000FBE; bytes:1 gbl_ccpr1l EQU 0x00000FBE; bytes:1 gbl_ccpr1h EQU 0x00000FBF; bytes:1 gbl_adcon2 EQU 0x00000FC0; bytes:1 gbl_adcon1 EQU 0x00000FC1; bytes:1 gbl_adcon0 EQU 0x00000FC2; bytes:1 gbl_adres EQU 0x00000FC3; bytes:1 gbl_adresl EQU 0x00000FC3; bytes:1 gbl_adresh EQU 0x00000FC4; bytes:1 gbl_sspcon2 EQU 0x00000FC5; bytes:1 gbl_sspcon1 EQU 0x00000FC6; bytes:1 gbl_sspstat EQU 0x00000FC7; bytes:1 gbl_sspadd EQU 0x00000FC8; bytes:1 gbl_sspbuf EQU 0x00000FC9; bytes:1 gbl_t2con EQU 0x00000FCA; bytes:1 gbl_pr2 EQU 0x00000FCB; bytes:1 gbl_tmr2 EQU 0x00000FCC; bytes:1 gbl_t1con EQU 0x00000FCD; bytes:1 gbl_tmr1l EQU 0x00000FCE; bytes:1 gbl_tmr1h EQU 0x00000FCF; bytes:1 gbl_rcon EQU 0x00000FD0; bytes:1 gbl_wdtcon EQU 0x00000FD1; bytes:1 gbl_hlvdcon EQU 0x00000FD2; bytes:1 gbl_osccon EQU 0x00000FD3; bytes:1 gbl_t0con EQU 0x00000FD5; bytes:1 gbl_tmr0l EQU 0x00000FD6; bytes:1 gbl_tmr0h EQU 0x00000FD7; bytes:1 gbl_fsr2l EQU 0x00000FD9; bytes:1 gbl_fsr2h EQU 0x00000FDA; bytes:1 gbl_plusw2 EQU 0x00000FDB; bytes:1 gbl_preinc2 EQU 0x00000FDC; bytes:1 gbl_postdec2 EQU 0x00000FDD; bytes:1 gbl_postinc2 EQU 0x00000FDE; bytes:1 gbl_indf2 EQU 0x00000FDF; bytes:1 gbl_bsr EQU 0x00000FE0; bytes:1 gbl_fsr1l EQU 0x00000FE1; bytes:1 gbl_fsr1h EQU 0x00000FE2; bytes:1 gbl_plusw1 EQU 0x00000FE3; bytes:1 gbl_preinc1 EQU 0x00000FE4; bytes:1 gbl_postdec1 EQU 0x00000FE5; bytes:1 gbl_postinc1 EQU 0x00000FE6; bytes:1 gbl_indf1 EQU 0x00000FE7; bytes:1 gbl_wreg EQU 0x00000FE8; bytes:1 gbl_fsr0l EQU 0x00000FE9; bytes:1 gbl_fsr0h EQU 0x00000FEA; bytes:1 gbl_plusw0 EQU 0x00000FEB; bytes:1 gbl_preinc0 EQU 0x00000FEC; bytes:1 gbl_postdec0 EQU 0x00000FED; bytes:1 gbl_postinc0 EQU 0x00000FEE; bytes:1 gbl_indf0 EQU 0x00000FEF; bytes:1 gbl_intcon3 EQU 0x00000FF0; bytes:1 gbl_intcon2 EQU 0x00000FF1; bytes:1 gbl_intcon EQU 0x00000FF2; bytes:1 gbl_prod EQU 0x00000FF3; bytes:1 gbl_tablat EQU 0x00000FF5; bytes:1 gbl_tblptr EQU 0x00000FF6; bytes:1 gbl_tblptrl EQU 0x00000FF6; bytes:1 gbl_tblptrh EQU 0x00000FF7; bytes:1 gbl_tblptru EQU 0x00000FF8; bytes:1 gbl_pc EQU 0x00000FF9; bytes:1 gbl_pcl EQU 0x00000FF9; bytes:1 gbl_pclath EQU 0x00000FFA; bytes:1 gbl_pclatu EQU 0x00000FFB; bytes:1 gbl_stkptr EQU 0x00000FFC; bytes:1 gbl_tos EQU 0x00000FFD; bytes:1 gbl_tosl EQU 0x00000FFD; bytes:1 gbl_tosh EQU 0x00000FFE; bytes:1 gbl_tosu EQU 0x00000FFF; bytes:1 main_1_counter EQU 0x00000008; bytes:1 delay_ms_00000_arg_del EQU 0x0000000A; bytes:1 delay_s_00000_arg_del EQU 0x00000009; bytes:1 Int1Context EQU 0x00000001; bytes:2 Int2Context EQU 0x00000003; bytes:5 ORG 0x00000800 GOTO _startup ORG 0x00000808 GOTO interrupt ORG 0x00000818 GOTO interrupt_low ORG 0x0000081C delay_ms_00000 ; { delay_ms; function begin MOVF delay_ms_00000_arg_del, F BTFSS STATUS,Z GOTO label4026531858 RETURN label4026531858 MOVLW 0xF9 label4026531859 NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP ADDLW 0xFF BTFSS STATUS,Z GOTO label4026531859 NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP DECFSZ delay_ms_00000_arg_del, F GOTO label4026531858 RETURN ; } delay_ms function end ORG 0x00000878 delay_s_00000 ; { delay_s; function begin label4026531864 MOVLW 0xFA MOVWF delay_ms_00000_arg_del CALL delay_ms_00000 MOVLW 0xFA MOVWF delay_ms_00000_arg_del CALL delay_ms_00000 MOVLW 0xFA MOVWF delay_ms_00000_arg_del CALL delay_ms_00000 MOVLW 0xFA MOVWF delay_ms_00000_arg_del CALL delay_ms_00000 DECFSZ delay_s_00000_arg_del, F BRA label4026531864 RETURN ; } delay_s function end ORG 0x0000089E main ; { main; function begin CLRF gbl_portd CLRF gbl_latd CLRF gbl_trisd CLRF main_1_counter label268436372 MOVF main_1_counter, W MOVWF gbl_latd INCF main_1_counter, F MOVLW 0x01 MOVWF delay_s_00000_arg_del CALL delay_s_00000 BRA label268436372 ; } main function end ORG 0x000008B6 interrupt_low ; { interrupt_low; function begin MOVFF STATUS, Int2Context MOVWF Int2Context+D'1' MOVFF BSR, Int2Context+D'2' MOVFF FSR0H, Int2Context+D'3' MOVFF FSR0L, Int2Context+D'4' MOVFF Int2Context+D'4', FSR0L MOVFF Int2Context+D'3', FSR0H MOVFF Int2Context+D'2', BSR MOVF Int2Context+D'1', W MOVFF Int2Context, STATUS RETFIE ; } interrupt_low function end ORG 0x000008DC _startup GOTO main ORG 0x000008E0 interrupt ; { interrupt; function begin MOVFF FSR0H, Int1Context MOVFF FSR0L, Int1Context+D'1' MOVFF Int1Context+D'1', FSR0L MOVFF Int1Context, FSR0H RETFIE 1 ; } interrupt function end END HEX file produced by Boost IDE: :040800006EEF04F0A3 :0408080070EF04F099 :080818005BEF04F00A52D8A4C2 :1008200013EF04F01200F90E0000000000000000B9 :1008300000000000000000000000000000000000B8 :100840000000000000000000FF0FD8A414EF04F027 :100850000000000000000000000000000000000098 :100860000000000000000000000000000000000088 :100870000A2E13EF04F01200FA0E0A6E0EEC04F0CA :10088000FA0E0A6E0EEC04F0FA0E0A6E0EEC04F08C :10089000FA0E0A6E0EEC04F0092EEED71200836AEF :1008A0008C6A956A086A08508C6E082A010E096ED7 :1008B0003CEC04F0F8D7D8CF03F0046EE0CF05F09D :1008C000EACF06F0E9CF07F007C0E9FF06C0EAFF6C :1008D00005C0E0FF045003C0D8FF10004FEF04F044 :1008E000EACF01F0E9CF02F002C0E9FF01C0EAFF60 :0208F0001100F5 :00000001FF HEX file produced by MPLAB IDE: :020000040000FA :040800006EEF04F0A3 :0408080070EF04F099 :080818005BEF04F00A52D8A4C2 :1008200013EF04F01200F90E0000000000000000B9 :1008300000000000000000000000000000000000B8 :100840000000000000000000FF0FD8A414EF04F027 :100850000000000000000000000000000000000098 :100860000000000000000000000000000000000088 :100870000A2E13EF04F01200FA0E0A6E0EEC04F0CA :10088000FA0E0A6E0EEC04F0FA0E0A6E0EEC04F08C :10089000FA0E0A6E0EEC04F0092EEED71200836AEF :1008A0008C6A956A086A08508C6E082A010E096ED7 :1008B0003CEC04F0F8D7D8CF03F0046EE0CF05F09D :1008C000EACF06F0E9CF07F007C0E9FF06C0EAFF6C :1008D00005C0E0FF045003C0D8FF10004FEF04F044 :1008E000EACF01F0E9CF02F002C0E9FF01C0EAFF60 :0208F0001100F5 :00000001FF
×
×
  • Create New...