Fix: Correct _LINE() assignment of LINE()
Updated copyright
Fix: Corrected DAT file
Donation date updated.
Updated copyright dates
Can you upload a GCB source that compiles? The one above has errors. This would really help.
Hello Anobium, nop, even #DEFINE SYSDEFAULTCONCATSTRING 8 does not help mplab c18 privides a char* pBuffer[255] '(for example) Shouldn't a too long string space allocation lead to a compiler error or warning?
OK. Before I start. Try the UserCodeOnly option with the AVR. What explicitly needs changing? And, you must use AVRASM2 as the selected tool to ensure ASM we are generating is valid. So, you can take the ASM generated by GCBASIC, make your changes and validate these changes using AVRASM2. I really need a reference ASM file. My tests here. My source: ( first-demo.gcb) #chip mega328p #option Explicit #option UserCodeOnly INITMCU: INITMCU: Give AVRASM2 errors. GCBASIC (2026.02.07 (Windows 64 bit) :...
and, you do not need MPLAB-X to use PIC-AS. There is download in the Files tool of this forum that has all the required files. This is an interim drop whilst the next release properly disassociates GCSTUDIO from MPLAB-X.
short answer: yes, if chip have debugging silicon, it can be debugged with gcstudio; the only limitation are chips without debug silicon, but they can't be debugged with anything so not tool fault. Angel
Excellent idea Angel. With later releases, Microchip has moved PIC-AS into different folders within MPLAB X. I'm wondering, will the new GCBASIC debugger work with the earlier PIC chips that were only supported when using MPASM?
Hi Evan, To test your suggestion, I compiled the UserCodeOnly option for a PIC. This is exactly the feature I was missing at GCB when programming Thallium! I'm looking forward to it. All vectors can be entered before the INITMCU label in the BASIC program. This can also be done with a macro (which looks better). I think its behavior doesn't need to change with an AVR microcontroller, except that rjmp INITMCU must be generated in the ASM file instead of goto INITMCU. Cheers Ralf
Ralf, Recommend you try option UserCodeOnly INITMCU add a label called INITMCU: at the top of the your program. What needs to be resolved there? I mean. We need to change what to make this preprocessor instruction behave on the AVR compared to a PIC. As we cannot change the behaviour of option UserCodeOnly ( beyond fixing the PIC/AVR compatibilty ) we should then add a new preprocessor instruction option RemoveAVRInterruptVectors. What is the exact need ? Removal of what ? I think I need examples...
Problably string allocation space. You are using an old PIC and the string allocation is small. Try adding #DEFINE SYSDEFAULTCONCATSTRING 16 where 16 is the largest string you are trying to handle.
Hello everybody, i observed a strange behavior. As soon as i convert a value into a string the touch screen stops working. Weird enough, the same source code works with a 18F6585 and ili9481 in16bit parallel mode. Any ideas appreciated. Thanks in advance mafuta
Hi, For Thallium, the GCB initialization with INITSYS and BASPROGRAMSTART can remain as is. Only the enabling of global interrupts (sei) occurs slightly too early, but I can immediately undo this afterward. Therefore, this has no impact on the program. The situation is different with the removal of the interrupt vectors. This would indeed be a significant improvement, especially for traditional AVR chips. Unlike more modern AVR chips, traditional AVR chips do not allow you to determine within the...
I am not sure I am seeing any issue. Have a look at this. #chip 18F27Q43 // #chip 18F16Q41 #script SER1_BAUD = 9600 CHIPSELECT = 0 If CHIPNAME = 18F27Q43 Then SER1_TXPORT = PORTC SER1_TXPIN = 7 SER1_RXPORT = PORTB SER1_RXPIN = 0 CHIPSELECT = CHIPSELECT + 1 USART_BAUD_RATE = 9600 USART_TX_BLOCKING = "" USART_DELAY = OFF USART4_BAUD_RATE = 9600 USART4_TX_BLOCKING = "" USART4_DELAY = OFF End If If CHIPNAME = 18F16Q41 Then ' example for another chip SER1_TXPORT = PORTA SER1_TXPIN = 4 SER1_RXPORT = PORTC...
Very good. There is another similar OS in the demo pack, so, this is a great addition. An insight/question. Would you to override the INITSYS? and the BASPROGRAMSTART jmp ( at vector 0 ) and put you own label to handle the init as you wish? I would be possible to do this with a tweak in the AVR part of the compiler ( it already does this for the PICs ). And, would it also be useful to remove the Interrupt vectors ( not implemented but this would be rather easy to do )? We can create initialisation...
thank you for the insight. in the next release of GCStudio we are going to have an integrated version of pic-as inside of GCStudio (so we no longer need to have mplabx installed) Angel
For those who can't locate the PIC-AS.EXE file in their recent MPLABX installation, perhaps look for it in the Microchip C Compiler. Yesterday I downloaded the latest MPLABX ver 6.30 and, after extensive searching, it appears that Microchip have decided that the PIC-AS.EXE file should now be part of their C Compiler. My Microchip C Compiler got updated at the same time (as I selected the simulator option). YMMV, however this is a heads up if you can't locate it within MPLABX. Added: I should have...
For those who can't locate the PIC-AS.EXE file in their recent MPLABX installation, perhaps look for it in the Microchip C Compiler. Yesterday I downloaded the latest MPLABX ver 6.30 and, after extensive searching, it appears that Microchip have decided that the PIC-AS.EXE file should now be part of their C Compiler. My Microchip C Compiler got updated at the same time (as I selected the simulator option). YMMV, however this is a heads up if you can't locate it within MPLABX.
Hi, About 25 years ago, I started writing an RTOS for what was then the first AVR microcontroller with sufficient SRAM (for those in the know, the ATmega103). Due to lack of time and the necessary expertise, I soon abandoned the project. Although GCB might not seem very useful for assembly programming at first glance, it has greatly helped me revive my old project. I've given the project the working title Thallium. Although I wrote Thallium almost entirely in assembly, I hope it will be of interest...
The only things I changed was to move both hardware serial outs onto USART3 which was the only available one that covered both 'legs' and ports that I needed. That single change allowed both devices to work. Using USART(1) and USART4 in the same program failed with no indication that it would. I'm pretty sure that the 18F27Q43 did work, as it does have both USART(1) and USART4, the 18F16Q41 certainly didn't. A change to the PPS for both devices to move USART3 and then defining a single instance of...
Hard to say without the code/program. Many people have mutliple configs is a program. So, this should work.
Hard to say without the code/program.
As much as I can gather, this was related to me using (hardware) USART 1 on the 18F16Q41 and USART 4 on the 18F27Q43. Defining the USART_BAUD_RATE as 9600 caused no issues, but defining USART4_BAUD_RATE 9600 threw an error when compiling for the 16Q41. No doubt as it has no USART4. I'd moved these within a "IfDef" test which cleared the errors, but something must have been silently failing. I tried placing the USART_BAUD_RATE declarations within the script but that didn't work. Eventually I realised...
As much as I can gather, this was related to me using (hardware) USART 1 on the 18F16Q41 and USART 4 on the 18F27Q43. Defining the USART_BAUD_RATE as 9600 caused no issues, but defining USART4_BAUD_RATE 9600 threw an error when compiling for the 16Q41. No doubt as it has no USART4. I'd moved these within a "IfDef" test which cleared the errors, but something must have been silently failing. I tried placing the USART_BAUD_RATE declarations within the script but that didn't work. Eventually I realised...
The script worked very well, the soft serial is operating and (almost) all re-directed pins function as they should. I say almost... I have an unused pin, Pin 10, RB7 on the physical 18F16Q41 which on my SOIC 28pin - 20pin DIL adaptor for the 27Q43 is connected to Pin 9, RA7. I'm using this as a serial debug out to send information about various parameters within critical subroutines for debugging, this is then displayed on a remote 4 line LCD display. To make this work I'm using PPS to swap the...
Good spot. There must have been an error in one the import files. I have updated the master file in the repository.
Hi, The chip data for the mega328pb shows the same address for both SPL and SPH: 62. That can't be right. I changed the SPL address to 61. Ralf
Thanks for the quick reply. Ralf
The compiler does all the control of the interrupt(s). You could change this behaviour by changing the source. But, it would be a huge piece of work. Working with the Sub Interrupt maybe your best way forward.
Hi, In GCB, there are two ways to use the interrupt: On Interrupt: Jumps from the specified interrupt vector to a subroutine created by GCB and calls my interrupt handler from there. Disadvantage: This modifies some registers. Subroutine Interrupt: Jumps directly from all interrupt vectors to my interrupt handler. If I have selected the NoContextSave option, no registers are modified by GCB (neither before nor after my code in the interrupt handler). Some controllers automatically clear their interrupt...
I added to your source as a header. Looks nice. Most interestng. I also compiled using AVRASM2 ( as a validation ). Compiled very nicely. :-) This means the ASM generated is 100% valid. I have attached the LST file for your review.
Hi Evan, First of all: You've written a very nice website about it. Thank you! Explaination of port usage: Port usage is flawless and certainly very helpful. Do you mean I should add it to the GCB file, or do you want to add it to the demonstration Git/Repository web side? I think both options are fine. Ralf
Ralf is this good to add? This is meant to explain the port usage. Evan #IF CHIPNAME = mega328p or CHIPNAME = mega328pb /* ------------PORTA--------------- Bit#: -7---6---5---4---3---2---1---0--- IO: --------------------------------- IO: --------------------------------- (PORTA not used in this program) ------------PORTB---------------- Bit#: -7---6---5---4---3---2---1---0--- IO: -- -- LED Btn-d Btn-u Btn-s -- -- IO: PB7 PB6 PB5 PB4 PB3 PB2 PB1 PB0 LED on PB5 (Arduino pin 13) Buttons: PB2=Set, PB3=Up,...
I did miss testing IC2 in the 328pb. Here is what was formally tested. ATMEGA328pb_boards https://github.com/GreatCowBASIC/Demonstration_Sources/tree/main/Vendor_Boards/ATMEGA328pb_boards
see https://github.com/GreatCowBASIC/Demonstration_Sources/tree/main/LCD_Solutions/Large_Font_LCD_Solutions/2004_large_font A good example!
see https://github.com/GreatCowBASIC/Demonstration_Sources/tree/main/LCD_Solutions/Large_Font_LCD_Solutions/2004_large_font A good example!
I've added the warning. The file is attached.
Add a Warning into the #script to say that ATmega328p has not been tested, but, should work... let us know if is does....
Add samevars for 328PB
Great change. I will add the master HWI2C.h now. I have added this. It is a faster method. // Samevars for 328PB I2C #samevar TWBR, TWBR0 #samevar TWCR, TWCR0 #samevar TWSR, TWSR0 #samevar TWDR, TWDR0 Evan
Huge congratulations to the GCBASIC team on an incredible 2025! Reaching the 20-year mark since Hugh first wrote the compiler is a testament to the project's resilience and the value it provides to the maker community. Learn more about the project's journey and how it has evolved over the years.
Huge congratulations to the GCBASIC team on an incredible 2025! Reaching the 20-year mark since Hugh first wrote the compiler is a testament to the project's resilience and the value it provides to the maker community. [Learn more](https://thepenaltyshooters.com/ about the project's journey and how it has evolved over the years.
Hi, I only have an ATmega328pb and not an ATmega328p in my parts bin. Therefore, I tested the program with an ATmega328pb and not an ATmega328p. I specified the ATmega328p as the chip because the compiler worked with that chip. I've since managed to fix this error (more details in another post). Therefore, I've updated the file again (see attachment). However, I have no way to test the program with an ATmega328p, but it will most likely work as well. Perhaps someone who owns an ATmega328p could test...
Hi, If you write a BASIC program for an ATmega328pb and use the HWI2C instructions, an assembly error occurs. This happens because the register names in the ATmega328pb's chip data differ from those of other microcontrollers (e.g., ATmega328p). The error can be fixed by inserting a script like this into the hwi2c.h file: #script if CHIPNAME = mega328pb then TWBR = TWBR0 TWCR = TWCR0 TWSR = TWSR0 TWDR = TWDR0 end if #endscript Cheers
I have seen that movie!! :-)
Yes, but I wish I had recorded it. I could have released it as a movie: "Staring at code".
It is a great method!!
Ouch! :( -A moment of silence- While you replied I had hooked it up and got it working on 18F57Q84. I should have done that sooner and not kept staring at the code example... And yes the code has probably been chopped up and changed. That is why the figures didn't make sense. I could remove #config CLKOUTEN_ON which added to the confusion as I saw no purpose. SMT_FOSC didn't work on this chip while changing to FOSC did. This could be the sample clock that I have been looking for. High resolution...
Ouch! :( -A moment of silence- I now hooked it up and got it working on 18F57Q84. I should have done that sooner and not kept staring at the code example... And yes the code has probably been chopped up and changed. That is why the figures didn't make sense. I could remove #config CLKOUTEN_ON which added to the confusion as I saw no purpose. SMT_FOSC didn't work on this chip while changing to FOSC did. This could be the sample clock that I have been looking for. High resolution and no startup procedure...
My analysis of Bill's other demo. '''-------------------------------------------------------------------------------------------------------------------------------- '''A Debug Program for SMTTimers.h ''' WilliamR ' #chip 16f18855, 32 #option explicit #include <smt_timers.h> WAIT 500 MS DIR PortC.3 OUT 'LED 'Tune internal OSC for best accuracy so 'that 1,000,000 timer ticks = 1,000,000 us OSCTUNE = 0b11111100 InitSMT1(SMT_FOSC,SMTPres_1) '1 MHz 'Period = 1,000,000 microseconds (1 Second) SETSMT1PERIOD(16000000)...
Looking at the GCBASIC demos by BillR, the timer calculation is based on creating a 1-second interrupt interval using the SMT1 (Signal Measurement Timer) module. '''-------------------------------------------------------------------------------------------------------------------------------- '''A Debug Program for SMTTimers.h ''' WilliamR ' #chip 16f18855, 32 #option explicit #include <smt_timers.h> WAIT 500 MS DIR PortC.3 OUT 'LED 'Tune internal OSC for best accuracy so 'that 1,000,000 timer ticks...
Bill Roth was the expert on SMT. He passed away last year. :-( The most relevant application note / technical brief for it is TB3129 – "Signal Measurement Timer on PIC MCUs". Direct PDF URL: https://ww1.microchip.com/downloads/en/appnotes/90003129a.pdf This document explains the SMT module's features, configuration, modes (like period/duty cycle measurement, time-of-flight, etc.), and code examples. If you're looking for something more specific (e.g., auto-calibration using SMT in AN2030): https...
Yes. While trying to figure it out I stalled at: If InitSMT1(SMT_FOSC,SMTPres_1) and SETSMT1PERIOD ( 4045000 ) -> 1s period How can InitSMT2(SMT_FOSC4,SMTPres_8) and SETSMT2PERIOD ( 9322401 ) -> 4,6s period The code was at some point changed from doing something else than just blinking LEDD2 and LEDD3?
Is the question 'how to do the SMT calcs'? I will correct the Help.
In this example at: https://gcbasic.sourceforge.io/help/_smt_timers.html How do one arrive at 1.000s and 4.600s (with the 32MHz clock)? BTW the second SETSMT1PERIOD should be SETSMT2PERIOD? #Chip 16F18855, 32 #option explicit #Include <SMT_Timers.h> #config CLKOUTEN_ON ... SETSMT1PERIOD ( 4045000 ) ' 1.000s period with the parameters of SMT_FOSC and SMTPres_1 within the clock variance of the interclock ' a perfect internal clock would be 4000000 SETSMT1PERIOD ( 9322401 ) ' 4.600s period with the...
Hanno, Please check your emails. :-) Thank you for your support for the GCBASIC project. Evan
The latest public release is 1.0126 with build 1523. We will open a beta program soon. We will post here and/or email key users as soon as possible. We can patch/MFP for anything that needs an immediate fix but we are still working on the build to create a seamless installation process.
GC Studio does not automatically get the latest updates (using 1.0126 compiler build 1523). How can I update manually. Thanks.
Hello Anobium. Thank You for "BAD ORG" fix build 1551. I installed it, and it works fine. Anyhow, it added 18 sec to compiletime! Also it ask me to donate witk red text and beeb!! I have donated with PayPal. I purchased bronze (25€). Is this enough to get rid of extra time and text for compile? Pls, let me have way to fix this! Br Hannu Koskinen
Already updated! Great stuff! -More than I asked for!
Many thanks for the suggestion. I was looking for guidance on scripts when I came across UnDefine. I do like the checks too, I'll make use of them. I'm not going to have a chance to look again until after the weekend, and if next week is as busy as this, possibly not until mid February. Once I get the time, I'll report back.
I have updated the Help check the online version tomorrow. :-)
either way would work, I would think the picture after picture would be fastest. But, do test to validate performance.
BTW. Is there a problem using the 16bit data block to store 8bit data side by side? Say I have two 8-bit pictures. Can I put then separately in the program code, with one in high byte and the other in low byte (efficient use of the 16 bits)? Or should I combine them into words? Even if I would test this and find it working, it may still not be correct, so that's why I'm asking.
I just wanted to make sure that we were talking about the same page.
i will to try and add reference to DataBlocks. The naming of webpages is part a mega tool that I just use to ceate all the different formats of the Help. So, i cannot change the page URL.
Since you use the nickname, it would be good if searching for it leads to the Data page? I have been wondering about: -Why Data Block and not DataBlock??? Now: -Ahh. -Yes, of course. :) // This is what I meant: https://gcbasic.sourceforge.io/help/data.html "An error has been encountered in accessing this page." ...4. Error type: 404 This works: https://gcbasic.sourceforge.io/help/_data.html
Did you mean this?: https://gcbasic.sourceforge.io/help/data.html Yes. Data Block is my nickname for it. it is really a DATA dataset. I will sort the link. Re the max value. It is dependent on the selected device. I can add this quick summary. Family Instruction Word Size Program Memory Word Width Maximum Value per Word (unsigned decimal) Hex Range Can store full 16-bit value (0–65535) in one word? PIC10 12-bit 12 bits 4095 0x000 – 0xFFF No PIC12 (baseline) 12-bit 12 bits 4095 0x000 – 0xFFF No PIC12...
"An error has been encountered in accessing this page" Did you mean this?: https://gcbasic.sourceforge.io/help/_data.html If does not mention the term Data Block, which I figured was there for not the same as Data. The link to ProgramRead in ..._data.html points back to ..._data.html The Programread page can be found by searching. It says that Programread is limited to storing up to 14bit vlues, which is not always true anymore, right?
The Data Blocks are in the latest help, see https://gcbasic.sourceforge.io/help/data.html If more is needed - can you provide me some words/example to add? I can do the editing here. but, do you want links from ProgramRead, ProgramWrite and ProgramErase or examples? and, do you want link from Data Blocks to ProgramRead? Should be
Wouldn't it be nice to have info on Data Blocks in the documentation? Since Data Blocks with the right chipsupports storing 16bit/word data, it would be helpful if the pages on ProgramRead, ProgramWrite and ProgramErase (if applicable) were updated with this info too? And that the Data Blocks info page linked to ProgramRead etc?
Wouldn't it be nice to have info on Data Blocks in the documentation? Since Data Blocks with the right chipsupports storing 16bit data, it would be helpful if the pages on ProgramRead, ProgramWrite and ProgramErase (if applicable) were updated with this info too? And that the Data Blocks info page linked to ProgramRead etc?
Very good work. The diagrams really help. I will include these in the demos as we dont have anything like these SPI examples. Thank you.
Also I made another project that communicate two PICs together. Here is the MASTER and SLAVE code below. 'SPI Master program #chip 16F877A, 4 dir PORTC.5 out 'SDO dir PORTC.3 out 'SCK dim inbyte as byte SPIMode (Master) do SPITransfer ( 0x55, inbyte) wait 1 s loop 'SPI Slave program #chip 16F877A, 4 #define USART_BAUD_RATE 9600 #define USART_TX_BLOCKING dir PORTC.4 in 'SDI dir PORTC.3 in 'SCK dim dat as byte SPIMode (Slave) On Interrupt SSP1Ready Call SPI_ISR do wait 1 s HserPrint dat HSerPrintCRLF...
Hi Venn, Thank you very much for helping me to get my code run. finally I figured out why my code wasn't running. It caused mainly wrong wiring with Arduino and also I didn't used an Interrupt handler. Here is the working code below, and It may help someone who need the assistance in case. #chip 16F877A, 4 #define USART_BAUD_RATE 9600 #define USART_TX_BLOCKING dir PORTA.5 in 'SS dir PORTC.4 in 'SDI dir PORTC.5 out 'SDO dir PORTC.3 in 'SCK dim dat as byte SPIMode (Slave) On Interrupt SSP1Ready Call...
This may be the the time to use a script. :-) I would. Scripts give a lot more flexibility and a lot less complex. Script make and manage constants during the preprocessor phase of compilation. You are working with constants. Check the CDF to see the outcome. I have added some checks ( warnings ) you can remove. Evan // #chip 18F27Q43 #chip 18F25K22 #script SER1_BAUD = 9600 CHIPSELECT = 0 If CHIPNAME = 18F27Q43 Then SER1_TXPORT = PORTC SER1_TXPIN = 7 SER1_RXPORT = PORTB SER1_RXPIN = 0 CHIPSELECT...
I've run into a problem. I need to 'swap' the port definitions for a softserial port. If I do this: #Define SER1_BAUD 9600 '#Define SER1_BAUD 9600 ' baudrate must be defined '#Define SER1_DATABITS 7 ' databits optional (default = 8) '#Define SER1_STOPBITS 2 ' stopbits optional (default = 1) '#Define SER1_INVERT Off ' inverted polarity optional (default = Off) #Define SER1_TXPORT PORTC ' I/O Port (without .bit) must be defined #Define SER1_TXPIN 7 ' Port Bit must be defined #Define SER1_RXPORT PORTB...
Thank you!
Huge congratulations to the GCBASIC team on an incredible 2025! Reaching the 20-year mark since Hugh first wrote the compiler is a testament to the project's resilience and the value it provides to the maker community.
Corrected license date
🚀 Exciting updates in the latest GCStudio release! From late October 2025 through January 2026, GCStudio continues to evolve with powerful compiler improvements, expanded device support, debugger enhancements, and a wide range of fixes across PIC, AVR, and LGT targets. This release cycle focuses heavily on performance, chip‑family expansion, DFP handling, DAT updates, and robustness improvements across the toolchain. Whether you're working with PIC-AS, tuning I²C on AVR, or pushing new PIC16F1xxx...
Very Cool!
Very nice. I like the configuration for many chips. Very clever. May I put this in the demonstration Git/Repository? This has some clever techniques. Evan
Hi, Today I'd like to present my program for a digital clock. The clock uses a cheap LCD display with 4 lines of 20 characters each. An ATmega328p, an ATmega2560, or an AVR128DA28 can be used as the microcontroller. I used the corresponding Arduino boards for program development. The program uses block graphics. Some readers may remember this technique from the days of the first home computers. Due to their limited processing power, graphics capabilities were very restricted back then. Therefore,...
This and similar keeps popping up: Turn off Synchronization: Set T0CON1bits.T0ASYNC = 1. Even though it seems counter-intuitive, on many PIC16F1xxxx devices, the internal clock source must be treated as asynchronous to the timer's internal logic, or the synchronization circuitry breaks the clock chain. -Often with a recommendation to set T0ASYNC = 0 when using the internal clock. So the recommendation is T0ASYNC = 0, because it is the correct config, but it is also advised against since it may cause...
I now asked googles AI about setting up Timer0 on the PIC16F15376 to output a signal on a hardware pin. It says that I should enable the bit that I made it tick on 16F15376. T0CON1bits.T0ASYNC = 1; // Asynchronous This with the internal oscillator HFINTOSC I also found this: Based on the Microchip errata documents for the PIC16(L)F153xx family (specifically document DS80000725B or similar), here is the information regarding the T0ASYNC (Timer0 Asynchronous Enable) issue affecting the PIC16F15376....
This and similar keeps popping up: Turn off Synchronization: Set T0CON1bits.T0ASYNC = 1. Even though it seems counter-intuitive, on many PIC16F1xxxx devices, the internal clock source must be treated as asynchronous to the timer's internal logic, or the synchronization circuitry breaks the clock chain. -Often with a recommendation to set T0ASYNC = 0 when using the internal clock. So the recommendation is T0ASYNC = 0, because it is the correct config, but it is also advised against since it may cause...
Ofcourse PIC16(L)F15356/75/76/85/86 Errata (DS80000725B) does not mention the issue, so I do not know the real source of it.
I now asked googles AI about setting up Timer0 on the PIC16F15376 to output a signal on a hardware pin. It says that I should enable the bit that I made it tick on 16F15376. T0CON1bits.T0ASYNC = 1; // Asynchronous This with the internal oscillator 1:1 I also found this: Based on the Microchip errata documents for the PIC16(L)F153xx family (specifically document DS80000725B or similar), here is the information regarding the T0ASYNC (Timer0 Asynchronous Enable) issue affecting the PIC16F15376. Issue:...
This is working on 18F57Q84 (without the extra T0CON1 hack) WIth 16F15376 I need to insert T0CON1=0b01110000 to get the interrupt. //#CHIP 18F57Q84,32 #CHIP 16F15376,32 #OPTION EXPLICIT DIR PORTC.0 out #define TMR0_16bit InitTimer0 Osc, PRE0_1 + TMR0_HFINTOSC , POST0_1 T0CON1=0b01110000 //hack for 16F15376 StartTimer 0 setTimer 0, 0xFFFE // Set the interrupt enable flag TMR0IE = 1 Do PORTC.0 = 1 PORTC.0 = 0 Loop Sub Interrupt TMR0IF = 0 setTimer 0, 0xFE00 End Sub
Yes, that makes sense.
I meant in my last example that the oscillator outputs to a the hardware port pin forever, without any additional work after setting it up and starting it. I'm not sure there is more needed really. I now tried that code on 18F57Q84. I can't get a signal at all unless I insert that T0CON1=0b01110000, so there probably is more to it. I just figured getting the output out without any interrupts etc, so than I can see and measure it.
You can always write to the registers - Is that what you mean?
I may be mistaken, but I have seen examples here and there that the Timer0 could be used this way on its own, wihout intervention, so I figured it was one way to isolate the problem.
Yes, I have now read T0CON1 back and I get 96, but there is no oscillator output. With my previous mis-reading/misunderstanding there is output, setting the T0ASYNC: TMR0 Input Asynchronization Enable bit 1 = The input to the TMR0 counter is not synchronized to system clocks. (0 = The input to the TMR0 counter is synchronized to FOSC/4) This is bit four of T0CON1=0b01110000 which works for some reason. I tried narrowing it down and tried this (timer0 is toggling PortC.0 directly): There is no output...
This magic is brilliant. Simulate... no... do it on the real hardware. :-) We may be a a week or so to get a Beta release out. But, as you can see... it is stable.
One word... Witchcraft. If I was to add a second word: Genius. I was watching the video with my jaw totally dropped. David Copperfield couldn't pull a better trick than that. I've no idea how it's done, but it's genius. I'm sure there's more to learn such as how I could simulate button presses and or input, but my word, that's clever. Very clever indeed.