Jump to content


  • Content Count

  • Joined

  • Last visited

Everything posted by kuyars

  1. Thank you! That makes perfect sense. I had somehow assumed that all the leading digits would be zeroes, but that may not necessarily have been the case. Your way is certainly better.
  2. I've found that the initialize function seems to work. However, the synchronize function doesnt. I'm not quite sure how to port that function over to BoostC from C2c Plus. Any help would be great.
  3. Hi, I'm trying to change my program over to make it work with the new BoostC compiler, but I'm really new at this and not quite sure if Im sustituting correctly. For example, in my old program I had this chunk of code: void initialize() { disable_interrupt(GIE); clear_wdt(); set_bit(STATUS, RP0); set_tris_a(00010000b); set_tris_b(00000000b); clear_bit(STATUS, RP0); output_port_a(00001000b); output_port_b(11111111b); } However, since the disable_interrupt() and set_tris_a(), etc functions are not in BoostC (although I could roll my own, but I still wouldnt know how to do it), I substituted the following code for the one above: void initialize() { clear_bit(intcon,GIE); clear_wdt(); set_bit(status, RP0); trisa = 0x10; trisb = 0x00; clear_bit(status, RP0); porta = 0x08; portb = 0xFF; } Line for line, does this substitution do the same thing as the original? I'm a little suspicious about the output_port_b() being the same as portb = whatever. Also, I had the following statement in my old program: while (!(input_pin_port_a(4))); which I substituted with: while (!((porta>>3) & 0xFF)); Likewise, would this do the same thing? I bitwised shifted it and then used a mask of 1's to filter out the pin that I want... Thanks in advance!! Im just getting started in PIC programming and I'm learning so many new things.
  4. Thank you very much, that did solve the problem!
  5. Thank you, I just removed it, but the same linker error appears with the following messages: BoostC Optimizing C Compiler Version 1.0 Alpha (for PIC16 architecture) Copyright(C) 2004 Pavel Baranov Copyright(C) 2004 David Hobday success BoostLink Optimizing Linker Version 1.0 Alpha Copyright(C) 2004 Pavel Baranov Copyright(C) 2004 David Hobday Duplicate global var: Failed Exit code was -1. [No error.] Removing target: prop.hex Failed to locate output file 'prop.hex' Done Failed
  6. Sure, thank you for the quick replies! I'll post my code below. Just a note, it's very messy and inefficient. Im just trying out new ideas and such. This is actually based on some code for a propeller clock that I found linked somewhere on this website. I'm just toying with it for now. Sorry for the mess. It compiles fine, however, the linker seems to give that "Duplicate GLobal Var" error that I spoke of earlier. Thank you. ======================================= #include <system.h> #include <boostc.h> #define DELAY 47 void initialize(); void do_delay(); char parse_string(char); void synchronize(); void outpu_letter(); void draw_border_line(); void display_scroll(); void display_fixed(); const char characters[]= { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, // ' ' 0 0xFF,0xDF,0xAB,0xAB,0xAB,0x87 // 'a' 1 }; const char *string = " test string1 #"; //const char *string = "test string2"; void initialize() { clear_bit(intcon,GIE); clear_wdt(); set_bit(status, RP0); trisa = 0x10; trisb = 0x00; clear_bit(status, RP0); porta = 0x08; portb = 0xFF; } void do_delay() { char count; for(count = 0; count < DELAY; count++) { nop(); } } char parse_string(char index) { char *temp_string; temp_string = string; switch(temp_string[index]) { case ' ': return 0; case 'a': return 1; case 'b': return 2; case 'c': return 3; case 'd': return 4; case 'e': return 5; case 'f': return 6; case 'g': return 7; case 'h': return 8; case 'i': return 9; case 'j': return 10; case 'k': return 11; case 'l': return 12; case 'm': return 13; case 'n': return 14; case 'o': return 15; case 'p': return 16; case 'q': return 17; case 'r': return 18; case 's': return 19; case 't': return 20; case 'u': return 21; case 'v': return 22; case 'w': return 23; case 'x': return 24; case 'y': return 25; case 'z': return 26; case '0': return 27; case '1': return 28; case '2': return 29; case '3': return 30; case '4': return 31; case '5': return 32; case '6': return 33; case '7': return 34; case '8': return 35; case '9': return 36; case '#': return 255; default: return 0; } return 0; } //Synchronize with the port A pin 4 which takes in the clock //information from the AC voltage coming in void synchronize() { char input; while (!((porta>>3) & 0xFF)); input = ((porta>>3) & 0xFF); while (input == ((porta>>3) & 0xFF)) { //output_port_b(11111111b); portb = 0xFF; } } void output_letter(char index) { char fixed_index,count; fixed_index = index * 6; for(count = 0; count < 6; count++) { //display the corresponding character in the character table on the LED array //output_port_b(characters[count + fixed_index]); portb = characters[count + fixed_index]; do_delay(); } //clear all the LEDs //output_port_b(11111111b); portb = 0xFF; do_delay(); } void draw_border_line() { //output_port_b(00000000b); portb = 0x00; do_delay(); //output_port_b(11111111b); portb = 0xFF; } void display_scroll() { char line_width = 0, text_index = 0, count = 0, string_num = 0; while(1) { synchronize(); //output_port_b(11111111b); portb = 0xFF; //this creates the speed of the scrolling text for(count = 7; count > line_width; count--) { do_delay(); } //display the characters in the string for(count = 0; count < 8; count++) { output_letter(parse_string(count+text_index)); } //increment the line width to reflect the current position line_width++; //check if the current line width is at the max circle spacing. //If so, reset the line width and increment the index into the //text string if(line_width == 8) { line_width = 0; text_index++; if (parse_string(text_index) == 255) { text_index = 0; } } draw_border_line(); } } void display_fixed() { char count = 0; while(1) { synchronize(); //output_port_b(11111111b); portb = 0xFF; //display the characters in the string for(count = 0; count < 7; count++) { output_letter(parse_string(count)); } //output_port_b(11111111b); portb = 0xFF; } } void main() { //initialize the PIC initialize(); //run the display_loop() function that repeats the scrolling string indefinitely display_scroll(); //display_fixed(); }
  7. Hi, Im having some problems with my code. Im using the newly released sourceboost with boostC. It was compiling fine with the c2c-plus compiler before and I just made some minor changes. It actually does say that BoostC compiled it successfully, but the linker says that there's a "Duplicate Global Var: " but nothing after the colon. I'm looking at my code and really cant see any instance of any possible global var. Any possible leads would be appreciated, thank you!
  8. Thank you everyone for your help. I had wrongly assumed that all environments will have these functions for use. I did just roll my own as suggested. However, I just downloaded the new SourceBoost to try the BoostC compiler. I installed it and changed the toolsuit to BoostC in the Options menu. However, it seems that all the C2C Plus functions such as disable_interrup(), clear_wdt(), set_tris_a(), etc dont work anymore. They arent recognized by the BoostC compiler. Is there any way to still use these functions or will I have to use inline assembly?
  9. well, I'm a student so all the environments have already been setup for us. VisualDSP++ for the blackfin, unix programming using vi and compiling with gcc, and visual studio series are some of the environments that I've used. I realize that the admins would have setup the header files, so I'd just like to know how to setup sourceboost so that I can use the string functions, thank you.
  10. Hi, I'm not that new to C programming, however, in all the IDEs I've used before, I've always freely included headers such as string.h, math.h, etc. I tried finding any instance of string.h (which I'd like to use for my program), but notice that there is no such file included with the installation. How can I use string.h with SourceBoost? Thanks in advance!
  • Create New...