Dang! Embarrassed. I knew that...ahem, more than 10 years ago! Thank you Angel.
hi Lewis and welcome. in deed the compiler is telling you that this part (pic 12f675) didn't have a port B (it's a tinny pic with only 6 IO pins) when you read the datasheet of that part you can see that those pins are called GP0, GP1, GP2, GP3, GP4 and GP5. you can use this designations in GC basic, so for example you can use: dir GP1 out do forever GP1 = 1 wait 1 s GP1 = 0 wait 1 s loop to blink a led on pin 6 happy coding! Angel
I am a Noobie feeling my way around. New GC Studio installation/latest version. Used: first-start-sample.gcb Added #option Explicit No errors were reported using #CHIP 16f886 Changed to an old PIC part in hand. #CHIP 12f675 [{ Line 42 PulseOut PortB.5, 100 ms "resource": "/c:/GCstudio/gcbasic/demos/first-lew-test.gcb", "owner": "gcb", "severity": 8, "message": "Variable PORTB was not explicitly declared", "source": "gcb", "startLineNumber": 42, "startColumn": 1, "endLineNumber": 42, "endColumn":...
Great question. Each is cumulative. Apply each one. If the MPK needs prerequisites then that should be in the package. Want a deep insight? open the MPK in pkzip, 7zip or your favourite archive package. All will be revealed.
Hello, Are the MPK package cumulative? Do we need to install all them one after other, or is always the latest only necessary? Thank
Build Note: mpk_build_1526.mpk 📦 Build Identifier Filename: mpk_build_1526_legcay_pwm_fix.mpk Build Number: 1526 Build Type: Library Patch / PWM Bugfix Date: 5 November 2025 Author: Angel Mier (SourceForge contributor) 🧩 Components Included Updated PWM library for legacy PIC chips Fix for HPWM compilation error on PIC16F876A and similar devices 🛠️ Changes & Fixes Resolved bug where HPWM failed to compile when assigning fractional values to DC1B0 Error previously triggered by code like: Error: Cannot...
Build Note: PWM_build_1526.mpk 📦 Build Identifier Filename: mpk_build_1526_legcay_pwm_fix.mpk Build Number: 1526 Build Type: Library Patch / PWM Bugfix Date: 5 November 2025 Author: Angel Mier (SourceForge contributor) 🧩 Components Included Updated PWM library for legacy PIC chips Fix for HPWM compilation error on PIC16F876A and similar devices 🛠️ Changes & Fixes Resolved bug where HPWM failed to compile when assigning fractional values to DC1B0 Error previously triggered by code like: Error: Cannot...
Build Note: mpk_build_1525 📦 Build Identifier Filename: mpk_build_1525_16F175xx_chipfilles.mpk Build Number: 1525 Build Type: Chipfile Extension / Device Support Update Date: 6 November 2025 Author: Anobium (SourceForge contributor) 🧩 Components Included New chipdata files for PIC16F175xx series Integration with GCSTUDIO for automatic installation Preliminary support for: PIC16F17524 PIC16F17525 PIC16F17526 PIC16F17544 PIC16F17545 PIC16F17546 PIC16F17554 PIC16F17555 PIC16F17556 🛠️ Changes & Fixes...
Build Note: mpk_build_1524 📦 Build Identifier Filename: mpk_build_1524_compiler_sub_parameter_improvements Build Number: 1524 Build Type: Maintenance / Diagnostic Enhancement Date: 25 October 2025 Author: Anobium (as posted on SourceForge) 🧩 Components Included GCBASIC compiler core messages.dat MPK diagnostic subsystem 🛠️ Changes & Fixes Improved error messaging when a Byte is passed to a Sub expecting a String Previously: ambiguous or misleading error output Now: clearer diagnostic to aid debugging...
okay! i have done that and is working now thank you Angel.
Disregard my previous post, Evan just fixed the bug on the library, download this attached package and double click on it to add to GC Studio, this should fix the issue. Test and report back. Angel
it seems to be a bug on the pwm code for the legacy chips, I found that If you change the pic speed to any value lower than 10mhz (like a 8mhz crystal) it compiles successfully on that chip, can you test if this work around produces the expected PWM?
Angel, what could be the problem, i wan to use the sample for something then found out isn't compiling, just stuck here (: samco
here is the gcb
here is the gcb
chip 16F876A,20 ;#option explicit ' --- 'Main code 'freq 40khz 'variable duty from 0% to 100% do 'Turn up brightness over 2.5 seconds For Bright = 1 to 255 HPWM 1, 40, Bright wait 10 ms next 'Turn down brightness over 2.5 seconds For Bright = 255 to 1 HPWM 1, 40, Bright wait 10 ms next loop
can you attach your source file or an example of the code that fails? this will help us to fix this more quickly. Angel.
hey, after i updating my compiler to the new version i got this error please someone should help me on how to solve it, on the old compiler it compile fine but when i copy past on new one it doesnt work rather show this error (2025.10.04 (Windows 64 bit) : Build 1523) pwm.h ** (461): Error: Cannot store 2.6 in the byte variable DC1B0 (System Include)
New chipdata files for PIC16F175xx. These are not validated but they will work. Apply using GCSTUDIO and this will be automatically installed.
Also, adding the following to PICKitPlus. Support for 9 new devices to be added: PIC16F17524 PIC16F17525 PIC16F17526 PIC16F17544 PIC16F17545 PIC16F17546 PIC16F17554 PIC16F17555 PIC16F17556
News. PIC16F175xx. Adding 12 new PICs. Microchip have actually added new PICs. I honestly thought that 8-bit PIC development had ceased. Well I got that wrong.
I went and temporarily edited out the warning for 64x32 in glcd-ssd_1306.h It compiles and seem to work, but it seems not practical for drawing many pixels, since it quickly eats up program memory. One pset in the normal way: Program Memory: 565/16384 words (3.45%) RAM: 304/2048 bytes (14.84%) One pset in low memory mode: Program Memory: 598/16384 words (3.65%) RAM: 178/2048 bytes (8.69%) I'm not sure if this can be made more efficient for the 64x32 and RAM or this as low as it gets. While comparing...
👍
Check the display datasheet.
It's true, I have to do some checks, but I took this data with an oscilloscope, and eventually it could be driven at lower frequencies.
I think you need to check the requirement for the LCD Drive (Multiplex) Signal Operating Frequency. You will cause permanent damage at the frequency you are trying to achieve. I think the frequency is a lot, lot lower.
ok I'll try the Timer1 route, the question is more than legitimate, I recovered some old displays and wanted to try to drive them, the controller chip is HD44100R, or LC7940.... I think it will be difficult, but I'll try
Prescaler 1:1; TMR1 Preload = 65504; Actual Interrupt Time 2us. Now... you can do anything else... when this is running. So, what display are driving? I think that is real question. What requires a frequency like that?
Ciao Anobium, volevo usare un timer a 8 bit per essere più veloce.
The post is incorrect. Do the maths and then manage the signal in the ISR.
Hi From a post on the Microchip website, I realized that with such a fast interrupt, the instructions must be limited, precisely because of the speed. So they recommend using the HPWM output. I needed a 500 kHz clock to drive a display, so I'll try that... Regards, Matteo
You need to use the 16bit timer. See the demo example. This is a bit of the demo. ' Initialise the timer. ' Firstly tell the compiler to use a 16bit timer for this demonstration #DEFINE TMR0_16BIT ' Prescaler ' 1:64 InitTimer0 Osc, PRE0_64 ' Start the Timer StartTimer 0 'Every 1 sec. 0x0bdc is calculated value using a tool like Mr E. Timer Helper using a 16bit value. SetTimer ( 0 , 0x0bdc ) Mr E. Timer Helper is also in the demo folders.
hi, I tried to improve the code, but unfortunately on port.0 I only get 192 kHz; I would expect a few MHz, even looking at the block diagram of the TMR0. MY CODE chip 18F25k22, 64 config osc = INTIO7 'on pin A.6 I see 16 MHz with an oscilloscope OPTION Explicit wait 1 s DIR porta.0 OUT InitTimer0 OSC, PRE0_1 On Interrupt Timer0Overflow Call clock set T0CS = 0 set psa = 1 set tmr0l= 255 starttimer 0 do loop SUB clock ' Clearing timer flag set TMR0IF = 0 porta.0 = ! porta.0 set tmr0l= 255 END SUB
Very funny!!
I now tested the above on a SSD1306 128x64. (#DEFINE GLCD_TYPE GLCD_TYPE_SSD1306) It worked fine. 1.1kB of ram shrunk to 200 bytes in LOWMEMORY_GLCD_MODE. -WOW! This screen is huge!!! :)
👍
I'm not sure if more is needed. I took some example from the help to start testing. The compiler says this and does not produce a hexfile. Error: GLCD_TYPE_SSD1306_64x32 in low memory mode not tested
Hi, The demo folder has an example: See C:\GCstudio\gcbasic\demos\Vendor_Boards\StartPIC18_Board\18f25k22\110_Rotate_the_LEDs_using_16bit_Timer0_.gcb
Post a program with the minimum code to get it to compile and draw line. It may not draw the line but the intent is to draw a line. Draw from top-left corner to bottom-right corner: This is a good test program. I would get the program working in normal mode then add the low memory mode. Then, I can have a look to see what is going on. I need to remind myself.
:-) At least I was on honest to have the library tell the truth. No tested means that I have no looked at the capability. Would mean that it may or it may not work...... As you found out. :-)
Hi everyone, I'm trying to use timer 0 to generate a frequency of 500 khz on porta.0. unfortunately at most I managed to make it work at a maximum of 130 khz. the micro is a pi 18F25k22. the GCSTUDIO version is the latest. I put some comments in the program I attach to clarify what I do. Thanks for your help chip 18F25k22, 64 config osc = INTIO7 'on pin A.6 I see 16 MHz with an oscilloscope set OSCCON = b'01110000' 'CONFIGURO OSCILLATORE E PLL 'st OSCCON2 = b'00000100' PLLCFG = on PLLEN = on set...
I tried #define GLCD_TYPE_SSD1306_LOWMEMORY_GLCD_MODE But then realized it is probably not for the 64x32 version. Trying this instead: #define GLCD_TYPE_SSD1306_64x32_LOWMEMORY_GLCD_MODE (which may be nonsense) the compiler accepts it, but the RAM use is still over 300 bytes, so I guess I am not doing it right or it is not implemented. My new and wild attempt: The pixel is drawn, but RAM use is not affected. The compiler probably have no idea what I'm asking for... :) #define GLCD_TYPE_SSD1306_64x32_CHARACTER_MODE_ONLY...
I thought I should try low memory mode and see what effect it has on RAM use, but I get: "Error: GLCD_TYPE_SSD1306_64x32 in low memory mode not tested" Can I test it or is it not implemented?
You might be able to try this perhaps? A "simple" way of generating low frequency PWM, and it looks as though it was written for a 12F1840 too. https://sourceforge.net/p/gcbasic/discussion/projects&guides/thread/807f5e795b/#a92e
I line 2 should it be: #define PWM_Duty 50 'Set duty cycle to 50 % You are correct. Also "You may be to do this will a timer and just generate your own signal at 32 mHz." should this be MHz ? You would have to set the timer2 to interrupt at the frequency you need. Then toggle the output port.
Thanks Evan ... really appreciate your help ... I need to get a prototype board set up for the PIC12F1840, so it may be a couple of days before I can test. I line 2 should it be: #define PWM_Duty 50 'Set duty cycle to 50 % Also "You may be to do this will a timer and just generate your own signal at 32 mHz." should this be MHz ?
By my calcs ( using the compiler ) the max chip frequency would be 4mHz for that slow PWM signal. You may be to do this will a timer and just generate your own signal at 32 mHz. Evan #chip PIC12F1840, 4 #option Explicit #define PWM_Freq 0.25 'Set frequency in KHz #define PWM_Duty 50 'Set duty cycle to 80 % PWMOn 'Turn on the PWM WAIT 10 s 'Wait 10 seconds PWMOff 'Turn off the PWM
Hi, I need to generate a Low Frequency PWM , preferrably with an 8 pin PIC device ... the PIC isn't doing much else other than generating a 3-stage PWM output ( i.e PWM 1 value for a period, the PWH 2 for a time period and then Period 3 continuous, until an input is triggered or the PIC is reset. The base frequency needs to around 250 Hz though. Am I correct in thinking this should be achievable with the PWM module on a PIC12F1840 with the internal oscillator set to 32kHz ? It's for a hydraulic valve...
A dramatic nail biter! :) Feeding this to the sub, total use of RAM in my program is 371bytes: Dim mystring as String mystring = "GAME" GLCDtinyPRINT (5 , 5 , mystring) Replacing with this = 335 bytes: GLCDtinyPRINT (5, 5, "GAME") In both cases the * x in the Dim displayText as string * x does not seem to affect the result, only increasing RAM use. It does not work a constraint either. However, putting the constraint/limitation - displayText as string * 2 - in the subroutine line, does limit and...
A dramatic nail biter! :) Feeding this to the sub is 371bytes: Dim mystring as String mystring = "GAME" GLCDtinyPRINT (5 , 5 , mystring) This is 335 bytes: GLCDtinyPRINT (5, 5, "GAME") In both cases the * x in the Dim displayText as string * x does not seem to affect the result, only increasing RAM use. It does not work a constraint either. However, putting the constraint/limitation - displayText as string * 2 - in the subroutine line, does limit and fix RAM to max 2 letters and only "GA" prints....
This must related to the scope of the string. I need Hugh. :-)
A dramatic nail biter! :) Feeding this to the sub is 371bytes: Dim mystring as String mystring = "GAME" GLCDtinyPRINT (5 , 5 , mystring) This is 335 bytes: GLCDtinyPRINT (5, 5, "GAME") In both cases the * x in the Dim displayText as string * x does not seem to affect the result, only increasing RAM use. It does not work a constraint either. However, putting the constraint/limitation - displayText as string * 2 - in the subroutine line, does limit and fix RAM to 2 letters and only "GA" prints. But...
MPK 1524 Improves error message when passing via a Sub call a Byte when the destination is a String.
This thread is a tracker for MPK updates. See https://sourceforge.net/p/gcbasic/discussion/579125/thread/8ddc9b892e/?page=2#c923 for insights into using MPK to update and manage GC Studio
MPK Files New Feature: A-Practical-Guide-to-MPK files This is new feature that Angel has introduced and implemented. Totally brilliant to make things so easy!
Improved error message when passing via a Sub call a Byte when the destination is a String
Yes. We have a solution but I want to know what is going on. :=)
Right, the whole string seems to be passed (why didn't I test this yesterday...) Len(displayText) is 9 bytes with "GAME OVER" for all below cases. TinyStringtoGLCDinasub.html reports: ... Chip resource usage: Chip Model: 16F15376 ... Dim displayText as string * 1 : Program Memory: 921/16384 words (5.62%) RAM: 340/2048 bytes (16.6%) Dim displayText as string * 10 : Program Memory: 921/16384 words (5.62%) RAM: 348/2048 bytes (16.99%) Dim displayText as string : Program Memory: 921/16384 words (5.62%)...
That is what I call clever. Huge saving. I am going to ask Hugh to explain what is going on here. But, we have a method.... define the string in the sub and I would set to the correct string size. It is not passing one character - this asm shows this. Be back on this... later. Hugh can take a long time to respond.
It works! It prints fine with it! 30 bytes saved. Oddly, if I try: Dim displayText as string * 1 Then it still prints "GAME OVER" and further 8 bytes are saved. Seems to me that it is passing the string/bytes one by one(?), or what may be happening? From 429 bytes, to 399, to 391 and 38 bytes saved.
It works! It prints fine with it! 30 bytes saved. Oddly, if I try: Dim displayText as string * 1 Then it still prints "GAME OVER" and further 8 bytes are saved. Seems to me that it is passing the string/bytes one by one(?), or what may be happening? From 429 bytes, to 399, to 391 and 38 bytes saved.
Can you try this ? I am interested in the results on real silicon. Sub GLCDtinyPRINT (smallfont_positionX, smallfont_positionY, displayText as string ) Dim displayText as string * 10 The difference here is the string is defined in the sub. I have done this is the past. Let me know what happens.
So I inserted my my code TinyStringtoGLCD PongyThingy Game and weird things happened. I changed from GLCDPRINT (which worked fine) to GLCDtinyPRINT which used my TinyStringtoGLCD drawing routine. As long as I only used it to print the ScoreR and ScoreL strings I could get it to work, but If I inserted the code line for "GAME OVER", then the screen would neither print ScoreR nor ScroreL, DESPITE that the condition for "GAME OVER" had not yet occured! Then at gameover condition I could sometimes get...
So I inserted my my code TinyStringtoGLCD PonyThingy Game and weird things happened. I changed from GLCDPRINT (which worked fine) to GLCDtinyPRINT which used my TinyStringtoGLCD drawing routine. As long as I only used it to print the ScoreR and ScoreL strings I could get it to work, but If I inserted the code line for "GAME OVER", then the screen would neither print ScoreR nor ScroreL, DESPITE that the condition for "GAME OVER" had not yet occured! Then at gameover condition I could sometimes get...
New Feature: A-Practical-Guide-to-MKP files This is new feature that Angel has introduced and implemented. Totally brilliant to make things so easy!
This is great news. Improved messages and a really simple way to fix and patch. MPK was Angels idea and his implementation. Absolutely brilliant!!! :-)
I updated before seeing the video. I was a little confused by the "remove selected" but I took a chance, just went ahead and it just worked! How great is that! Now there is a understandable "problems" message generated when I try to run the code that I asked about. It used to say that there were no problems and I had to select and scroll "terminal" to find out about the problem, then not exactly understanding what it meant. The reason for this thread. Thank you for the video explaining things, as...
GCBASIC shared a post on Ko-fi. https://ko-fi.com/post/New-GC-Studio-Feature--A-Practical-Guide-to-F1F61N8WGD
Attached is an update to improve the handling of this type of error. Apply the update module by double clicking it will install the patch files. You will need the latest build of GC Studio. This MKV contains all the new files and you can remove safely using the module manager within GC Studio.
💬 String Byte Allocation “Yes, and each character in a string is one byte?” Yes, each character in a string occupies one byte, plus one additional byte for internal management. Formula: Number_of_bytes_allocated = 1 + (length of string) 🧠 RAM Usage Guidelines for Strings “The standard size of RAM to use for the string is ‘40 bytes for devices with more RAM than 367 bytes’? Unless the string is in the subroutine call, then the standard size is one byte. Right?” The standard RAM allocation for a string...
Yes, and each character in a string is one byte? The standard size of RAM to use for the string is "40 bytes for devices with more RAM than 367 bytes"? -Unless the string is in the subroutine call, then the standard size is one byte. Right?
Not exactly correct. The compiler will allocate a standard size of RAM to use for the string. You can accept the default ( see the Help ) or adjust.
So, the compiler needs to know the number of letters to reserve, when sending it into the sub "directly" with the "oneliner" (no automatic buffer generated in this case). Good. Now I know. Thank you for the explanation.
Thank you. I undertand, And I thank you for the program. The error is actually correct. The error caused by the definition of the variable in the sub Sub GLCDtinyPRINT (smallfont_positionX, smallfont_positionY, displayText ). The displayText as shown above will be defined as a byte. The default variable type is a byte. This is should be a string. * A byte can handle a string like "H". "H" is treated as a byte when passed to the sub. * GLCDtinyPRINT (5, 5, sometext) works as sometext equates to an...
I am trying to use my code TinyStringtoGLCD that I wrote couple of months ago (you helped touching it up and posted it as a demo) and use it in another program. I need to talk to it in some way, so I used a sub to pass the parameters to it and to start it off. The problem I have is passing more than one letter through the sub in the oneliner below. The oneliner is more convenient in use than the workaround, especially when modifying code that alread has GLCDPRINT in it. No big deal other than that...
Roger - I am not sure what the issue is. Some simpl/example code would help. But, this works. #CHIP 16f886 #option Explicit GLCDtinyPRINT (5, 5, "H") End Sub GLCDtinyPRINT (smallfont_positionX, smallfont_positionY, displayText ) // Do something End Sub But, is the real question... 'how do I write my own GLCD routines while using all the GLCD functions ? As there is no point of writing the same string handlers. Just need what to change to interrupt the write processes. Answer: Take a copy of the GLCD...
I would like to use a subroutine like the GLCDPRINT command, just renaming it into GLCDtinyPRINT using my own code to write on screen. This way it would be easy to switch back and forth, when testing and sending simple fixed messages to the screen. GLCDtinyPRINT (5, 5, "H" as string) Sub GLCDtinyPRINT (smallfont_positionX, smallfont_positionY, displayText) ... ... This works, but is limited to one letter, otherwise I get: TinyStringtoGLCDinasub.gcb (76): Error: Duplicate, conflicting definition for...
I have emailed the developer again. I can try for you.
I have recovered the hard drive with a working instance of Real PIC simulator. The licence key must be in the actual executable program as there is nothing in the computer registry. I used to have a recovery program whuch would display the licence key but it won't look at this. Anyone any ideas
I have recovered the hard drive with a working instance of Real PIC simulator. The licence key must be in the actual executabe program as there is nothing in the computer registry. I used to have a recovery program whuch would display the licence key but it won't look at this. Anyone any ideas
Thank GCBasic Team for update ! Will certainly be benefit for my new project.
A visual showing the release. Big strides in microcontroller development! The latest GCStudio release packs powerful compiler upgrades, expanded display and communication libraries, and smoother support for PIC, AVR, and LGT platforms. ✨ Highlights: GC Studio management enhancements Even more GLCD support Enum support, shadow registers for RWM, Faster PICINFO tool and improved USART/LCD handling Fixes for Win11, RS232, ADC, and installation quirks
Exciting updates in the latest GCStudio release! October 2025, these enhancements from May to October continue to bolster the compiler's robustness, expand library capabilities for displays and communication, and squash pesky bugs for more reliable PIC, AVR, and LGT development. Whether you're optimizing for legacy hardware or diving into advanced features like enums and shadow registers, this batch makes coding microcontrollers even more efficient. Dive in below for the details—all changes are completed...
GC Studio Current Release: 1.01.26 (Oct 2025) Installer Downloads: GC Studio Latest Installer (Full Suite) GCB Demonstrations Pack Latest Demos Add on Pack
GC Studio Current Release: 1.01.26 (Oct 2025) Installer Downloads: GC Studio Latest Installer (Full Suite) GCB Demonstrations Pack Latest Demos Add on Pack Changes: Full Change Log Road Map Report a Bug! BugTracker Feedback Post on the Forum Source Code: GitHub GreatCowBASIC GitHub GC Studio Repositories: https://github.com/GreatCowBASIC/GCstudio https://github.com/GreatCowBASIC/GCcode https://github.com/GreatCowBASIC/GCB_Gold https://github.com/GreatCowBASIC/GCstudio_Installer https://github.com/GreatCowBASIC/Demonstration_Sources...
Amazon is for Traders. I did try the registration and I do not a UK Ltd Company. You can use direct payment, PayPal, Ko-Fi or eBay.
Hello Evan, Any possibility of donating via Amazon Pay. Have never used GCBASIC, but considering adding it to old MPLab. Cheers, Hanspeter.
Regression testing improvements
Exciting updates in the latest GCStudio release! October 2025, these enhancements from May to October continue to bolster the compiler's robustness, expand library capabilities for displays and communication, and squash pesky bugs for more reliable PIC, AVR, and LGT development. Whether you're optimizing for legacy hardware or diving into advanced features like enums and shadow registers, this batch makes coding microcontrollers even more efficient. Dive in below for the details—all changes are completed...
Exciting updates in the latest GCStudio release! October 2025, these enhancements from May to June continue to bolster the compiler's robustness, expand library capabilities for displays and communication, and squash pesky bugs for more reliable PIC, AVR, and LGT development. Whether you're optimizing for legacy hardware or diving into advanced features like enums and shadow registers, this batch makes coding microcontrollers even more efficient. Dive in below for the details—all changes are completed...
Release build number
☕ Back at it with more PIC microcontroller madness! If you've been tweaking PICKitPlus INIs or ranting about oscillator calibration, buckle up – this post is a treasure trove (and a cautionary tale) straight from the debug trenches. I just dropped this gem: a quick analysis of programming pitfalls for the PIC12F683 that could save your next flash session. Watch the intriguing video breakdown: Programming PIC12F683 – Hidden Dangers?. It dives into the nitty-gritty of flashing your PIC12F683, but the...