Jump to content

cac001

EstablishedMember
  • Content Count

    183
  • Joined

  • Last visited

Everything posted by cac001

  1. Asking for this kind of help means this LCD project is too complex for your level of experience. Use a very simple project to gain understanding of how to use the SourceBoost tools.
  2. I tried what you suggested but I cannot get TIMER0 to count from and external input. The next thing I tried was to use a PIC18F4550 as the target and RA4 as the T0CKI input. I connected a button plugin to RA4 and toggled it on and off but never saw TIMER0 count. Maybe I do not know how to get the simulator to see a change on T0CKI. There does not seem to be much in the way of details on how to use the simulator in the SourceBoost IDE documentation.
  3. That fixed it. Thanks. A follow on question: How do you get the external clock for TIMER0 to work in the simulator for the PIC18F46J50? Charles.
  4. Dave, I looked at the \SourceBoost\config\PIC18F46J50.tdf file and it does have issues. This is at the end of the file TargetConfig FOSC { // Oscillator Selection bits: ConfigRegAddr = 0x0000FFF8; ConfigBitMask = 0b00001111; ConfigSettings = 0b00000000, "LP","LP oscillator", 0b00000001, "XT","XT oscillator", 0b00000010, "HS","HS oscillator", 0b00000011, "RC","External RC oscillator, CLKOUT function on RA6", 0b00000100, "EC","EC oscillator, CLKOUT function on RA6", 0b00000101, "ECIO6","EC oscillator, port function on RA6", 0b00000110, "HSPLL","HS oscillator, PLL enabled (Clock Freq
  5. Here are four methods to toggle bit RA0: while (1) { lata.0 ^= 1; delay_ms(2); } 00E6 label4 00E6 7089 BTG gbl_lata,0 00E8 0E02 MOVLW 0x02 00EA 6E0C MOVWF delay_ms_00000_arg_del 00EC EC0EF000 CALL delay_ms_00000 00F0 D7FA BRA label4 while (1) { lata ^= 0b00000001; delay_ms(2); } 00E6 label4 00E6 0E01 MOVLW 0x01 00E8 1A89 XORWF gbl_lata, F 00EA 0E02 MOVLW 0x02 00EC 6E0C MOVWF delay_ms_00000_arg_del 00EE EC0EF000 CALL delay_ms_00000 00F2 D7F9 BRA label4 while (1) { lata.0 ? lata.0 = 0 : lata.0 = 1; delay_ms(2); } 00E6 label4 00E6 A08
  6. Bug description: The #pragma config for the PIC18F46J50 fails to set the configuration bits correctly. Steps to reproduce: Use this configuration: #pragma config XINST = OFF #pragma config STVREN = OFF #pragma config PLLDIV = 2 #pragma config WDTEN = OFF #pragma config CP0 = OFF #pragma config CPUDIV = OSC2_PLL2 #pragma config IESO = OFF #pragma config FCMEN = OFF #pragma config LPT1OSC = ON #pragma config T1DIG = OFF #pragma config FOSC = INTIO67 #pragma config WDTPS = 32768 #pragma config DSWDTPS = G2 #pragma config DSWDTEN = OFF #pragma config DSBOREN = OFF #pragma con
  7. If we regard the exit code in hex it is: 0xC0000005 I searched google with "windows hresult C0000005" or this link. After looking at a few of them this error may be a result of a failure of some other service in your windows system. You should check the event log to see of there is something odd going on.
  8. I'm sure that tejaswiyvs appreciates your reply. The content of your reply is a tad short on helpfulness. You could have mentioned that the header files for BoostC follow a long accepted convention where #define constants are always UPPER_CASE though the other popular C compilers for the PIC16F targets define the Special Function Registers with upper case. You may have gone farther saying that BoostC is more correct in the wider sense it is more trouble for a beginner to PIC and C programming because example source code from other PIC environments will not compile without changing the
  9. Picixe, danmc77, The PLL in the 18F4550 is a little more finicky. It is designed to multiply a 4MHz input to 96MHz. This is a 24x multiply. For this PLL to work well the input must be very close to 4MHz. Anything faster or slower runs the risk fo the PLL locking on to an alias of 4MHz. When using the PLL you are limited to crystals or oscillators that are 4MHz multiples of the PLL Prescaler selections of divides by 1, 2 , 3, 4, 5, 6, 10, and 12. This means frequencies of 4, 8, 12, 16, 20, 24, 40 and 48 MHz. If your crystal is not one of these then the PLL may not work. If you a
  10. Definitely not a bug: ;Address Opcode Disassembly ; 052 1623 BSF 0x23, 0x4 ; 053 14A4 BSF 0x24, 0x1
  11. Not portable code - if you are worried about that sort of thing. I would go for something like: char x = 0; do { ... ... } while( --x != 0 ); Regards Dave This is just a little more portable: char x = 0; do { ... ... } while((++x & 0xFF) != 0 ); Most compilers implement char as 8-bits. I am working with an embedded platform that has no 8-bit addressable registers or memory. Your example is not portable to this implementation.
  12. It may not be possible to alter configuration words from the bootloader context. Are you sure that your PIC is able to change configuration words while a program is running?
  13. I would like to help but there are some choices that only you can make. Depending on what you choose the fuse setting will become obvious. The PIC18F2550 has support to expose a USB endpoint. If you are developing a USB device you cannot use the internal oscillator as a clock source for the USB function block. You must use an external crystal or oscillator. If you are not using the USB and do not want an external crystal then the internal oscillator is your only clock choice. The maximum frequency available with the internal oscillator is 8MHz. So now you need to decide wh
  14. You may want to look at this site too: http://www.electronic-engineering.ch/micro...s/projects.html
  15. A reset should not be required, but a lot of USB hosts will power down when the last device disconnects. This is not too common on desktops but is typical for laptops. If your device is not self powered then when the host powers down the port your PIC will loose power too.
  16. Joachim, This is the wrong place to ask for example programmes using FlowCode. FlowCode is a graphical programming language made by Matrix Multimedia. You should be asking your questions here: Martix Multimedia FlowCode forums
  17. The answer is simple. The 16F88 has analog I/O that is enabled by default. This code is from the Microchip datasheet (DS30487C), section 5.1: BANKSEL PORTA; select bank of PORTA CLRF PORTA; Initialize PORTA by ; clearing output ; data latches BANKSEL ANSEL; Select Bank of ANSEL MOVLW 0x00 ; Configure all pins MOVWF ANSEL; as digital inputs MOVLW 0xFF ; Value used to ; initialize data ; direction MOVWF TRISA; Set RA<7:0> as inputs Try changing your init function: static void init( void) { porta = 0; ansel = 0; // <--- add this to your in
  18. You did not seem to get a response from Dave or Pavel, so here is my work around: ;///////////////////////////////////////////////////////////////////////////////// ;// Code Generator: BoostC Compiler - http://www.sourceboost.com ;// Version : 6.81 ;// License Type : Pro License ;// Limitations : PIC12,PIC16 max code size:Unlimited, max RAM banks:Unlimited ;///////////////////////////////////////////////////////////////////////////////// // File: bug22.C // Target: PIC16F88 // OS: WinXP, SP2 // SourceBoostIDE: 6.81 // Compiler: BoostC 6.81 // Reproducible: always // Expected behavi
  19. It looks like a bug when bit-wise operators are used in a case expression. /* File: bug21.C Target: PIC16F876A OS: WinXP, SP2 SourceBoostIDE: 6.81 Compiler: BoostC 6.81 Reproducible: always Expected behavior: compile without error Description: case statment reports a compile error when bit-wise operator is used in expression. "case (I2C_STATE_1):" reports an error "case ((1 << S | 1 << BF)):" reports an error "case (0x08 | 0x01):" reports an error changing #define for I2C_STATE_1 to an enum is a work around */ #include <system.h> #define
  20. ra68gi is a most honorable person. Thank you for the check that arrived today. Regards, cac
  21. The pointers for the "rom" storage class do not work like other pointers. There are several limitations that are not obvious. See this thread: http://forum.sourceboost.com/index.php?s=&...post&p=7891 And this thread: http://forum.sourceboost.com/index.php?s=&...post&p=7886 cac001
  22. The C standard lib function "puts" appends a carriage return and line feed to the string on output. This is a snippet from rs232_driver.h from the SourceBoost includes: void puts(char *source) { while (*source != 0) // wait until tx register is empty putc(*source++); putc(0x0d); putc(0x0a); } The code above shows where the CR and LF are comming from.
  23. The difference is that _INTOSC provides the FCYC clock output on the RA4/AN3/T1G/OSC2/CLKOUT pin. This should have no affect on the ADC but perhaps your circuit has something connected to the RA4 pin that will be an issue if the PIC were to drive this with a 1MHz clock.
  24. Using both IDEs (MPLAB and SourceBoost) and I compiled this code: // File: t3254p12300.c // Target: PIC16F684 // OS: WinXP, SP2 // MPLAB IDE: 7.62 interim // SourceBoostIDE: 6.80 // Compiler: BoostC 6.80 #include <system.h> unsigned int minimum = 0xFFFF; //local variable to store minimum time char i,j; //counters unsigned int sensor_time[5]; //array to store processed sensor measurement void main() { sensor_time[0] = 0x093D; sensor_time[1] = 0x08CD; sensor_time[2] = 0x08DE; sensor_time[3] = 0xFFFF; sensor_time[4] = 0xFFFF; for(i=0;i<=4;i++) //find minimum value of sensor_t
  25. These PICs have very limited RAM and stack. You may want to think about using assembly to the 12F510/16F506 PIC. They are just like the 16F54 type PICs with just a little more program space. It does not seem that BoostC supports the low end 12-bit, 2-level stack PICs.
×
×
  • Create New...