If I use it after the interrupt has triggered and before it triggers next time. What is it that may happen? You mean. If I use it within the interrupt handler . What is it that may happen? It should be ok.
I find this is intriging. Sorry for being persistant. If I am doing the multiplication inside the only interrupt, immediately storing the result. What may interrupt/corrupt it?
As there is no way of knowing when the maths was interrupted the W will be corrupted ( this is sort of a guaranteed ).
If I use it after the interrupt has triggered and before it triggers next time. What is it that may happen?
If you have an interrupt.. do not use PRODH. My advice. Use GCBASIC regular maths.
I meant your list above. ... PRODL/PRODH are global and not banked. Interrupts can corrupt them. Inline ASM can corrupt them. ... etc
Warnings! What warning? Memory warnings?
Just use normal maths. I would not underwrite any asumptions on the state of PRODH. You would have to disable interrupts, looks for errors and zero.
The warnings are likely no problem in my case. I will be using inside one single interrupt. It will be for generating audio, so a failure will not exactly be life threateneing to most humans. Good to know though.
"5. Trust the user not to need PRODH unless explicitly requested" So should I mutliply as usual with GCbasic and then read from prodh directly to paste a word together. Is that what this says? I could really use the resulting word value.
This reads like I am the smart one. I am not. I am looking at the code Hugh wrote when he was a youngling. He made the right decision from an architectual approach. Use the harware ONLY when safe and generated defensive/robust code. Thank you, Hugh.
🛠️ GCBASIC compiler behaviour PIC code generation This is the source for the compiler. 'Use hardware multiply instruction for byte*byte multiply If CalcType = "BYTE" And Act = "*" And ChipFamily = 16 Then If IsConst(V1) Then CurrLine = LinkedListInsert(CurrLine, " movlw " + Str(MakeDec(V1))) Else CurrLine = LinkedListInsert(CurrLine, " movf " + V1 + ",W") End If If IsConst(V2) Then CurrLine = LinkedListInsert(CurrLine, " mullw " + Str(MakeDec(V2))) Else CurrLine = LinkedListInsert(CurrLine, " mulwf...
It's not an issue. I just wondered why this behaviour and didn't understand it. If GCBASIC is already using the hardware multiplier, then I just wasted time. I searched and saw no mention about it, so I figured I it would be worth testing. It was late yesterday and I skipped measuring. I was thinking of doing it later, but there is no point if it is already used and then it is really great and now there is a thread about it, so the next fool is pointed in the right direction.
I am not sure I get the issue. When using ASM the compile will pass whatever you write direct to the assembler. It has NO constrains and to be honest.. even I no longer use ASM. I trust GCBASIC compiler more and more. The compile will use hardware multiple for PIC, AVR and LGT when it can. There has to be a hardware multiplier and it has to be 'safe' calculation. Safe being byte calculations as these hardware instructions do not update status flags (e.g., Zero or Carry), unlike the GCBASIC arithmetic...
Slowly getting there. I am now getting correct results from the 8x8 Hardware Multiplier of the PIC 18F57Q84. -Great stuff! I hacked back and forth and finally made it work after sliding around for a good while, but I wonder why I can sometimes use variables to the get numbers in and in other cases not. Is it because GC-basic decides to not interfer as soon as it detects assembler? #Chip 18F57Q84, 64 #Option Explicit #include <glcd.h> #DEFINE GLCD_TYPE GLCD_TYPE_SSD1306_64x32 #DEFINE GLCD_I2C_Address...
However, that is still not using the program I posted above called "I2C_Scanner.gcb".
Found it. (beginning to think my eyes were worse than they are.
Maximum and double click the words "Receive" "Transmit" "Settings"
This code does not compile. So, is this the code you copied from your editor?
Not sure how to show 'larger terminal window' Here is the code I have used. '''============================================================ ''' GCBASIC I2C Bus Scanner ''' Uses: Software I2C + softserial.h (bit-banged serial TX) ''' Target: PIC, AVR or LGT -- change #chip for your device ''' Author: EvanV Licence: GPL Version: 1.1a '''============================================================ ''' ''' OVERVIEW ''' -------- ''' This program scans the full I2C address space (0x00 to 0xFF) ''' and...
Post removed as unnecessary ~~~
Can you show the larger terminal window? and, post your source. Then, i can figure it out
I2C Scanner up and running now. Don't know why I found this so difficult to implement, the guide you provided was so explicit. Thank you. Still a bit confused with the I2C Adaptor address. The scanner reports 0x4E and 0x4F but the physical address should be 0xA0, 0xA1 or 0xA2 ??
Lifted, edit, posted. See https://github.com/GreatCowBASIC/Demonstration_Sources/blob/main/Music
As I said, I'm busy withe the I2C Scanner now.
Not happy. As I wasted my time. Ho hum.
I'm busy with that now. I found backtracking on older examples helped in identifing some od the prpblems.
That is discovery working. However, that is not using the program I posted above called "I2C_Scanner.gcb". You asked for a guide but did you use the code provided? I think not. I will delete this guide if it serves no purpose.
Nothing is better than the sweet taste of success. Very many things in the way preventing me from seeing the Terminal application regurgitate data. Now I can get on with my project Thank you so much for your help and encouragement, it is really appreciated.
Nothing is better than the sweet taste of success. Very many things in the way preventing me from seeing the Terminal application regurgitate data. Now I can get on with my project
Thank you! -Sure! Go ahead!
Genius code! May I make a YouTube video on this ?
A Polyphonic MUSICBOX on PIC 18F57Q84 using a sound sample as audio source. Exploring GCBasic programming , I decided to try and make a musicbox. It resulted in a polyphonic one that can play up to 8 independent voices simultaneously. I was asked to make a demo video and figured that 3min of a PIC chip just laying on my desk was kind boring to look at, so I added a LED-bar that shows when the voices are sounding. Here is a demo video: -Maple Leaf Rag by Scott Joplin (Public Domain). https://lineaudio.se/div/Musicbox%20Maple%20Leaf%20Rag.mp4...
A Polyphonic MUSICBOX on PIC 18F57Q84 using a sound sample as audio source. Exploring GCBasic programming , I decided to try and make a musicbox. It resulted in a polyphonic one that can play up to 8 independent voices simultaneously. I was asked to make a demo video and figured that 3min of a PIC chip just laying on my desk was kind boring to look at, so I added a LED-bar that shows when the voices are sounding. Here is a demo video: -Maple Leaf Rag by Scott Joplin (Public Domain). https://lineaudio.se/div/Musicbox%20Maple%20Leaf%20Rag.mp4...
A Polyphonic MUSICBOX on PIC 18F57Q84 using a sound sample as audio source. Exploring GCBasic programming , I decided to try and make a musicbox. It resulted in a polyphonic one that can play up to 8 independent voices simultaneously. I was asked to make a demo video and figured that 3min of a PIC chip just laying on my desk was kind boring to look at, so I added a LED-bar that shows when the voices are sounding. Here is a demo video: -Maple Leaf Rag by Scott Joplin (Public Domain). https://lineaudio.se/div/Musicbox%20Maple%20Leaf%20Rag.mp4...
A Polyphonic MUSICBOX on PIC 18F57Q84 using a sound sample as audio source. Exploring GCBasic programming , I decided to try and make a musicbox. It resulted in a polyphonic one that can play up to 8 independent voices simultaneously. I was asked to make a demo video and figured that 3min of a PIC chip just laying on my desk was kind boring to look at, so I added a LED-bar that shows when the voices are sounding. Here is a demo video: -Maple Leaf Rag by Scott Joplin (Public Domain). https://lineaudio.se/div/Musicbox%20Maple%20Leaf%20Rag.mp4...
A Polyphonic MUSICBOX on PIC 18F57Q84 using a sound sample as audio source. Exploring GCBasic programming , I decided to try and make a musicbox. It resulted in a polyphonic one and can play up to 8 independent voices simultaneously. I was asked to make a demo video and figured that 3min of a PIC chip just laying on my desk was kind boring to look at, so I added a LED-bar that shows when the voices are sounding. Here is a demo video: -Maple Leaf Rag by Scott Joplin (Public Domain). https://lineaudio.se/div/Musicbox%20Maple%20Leaf%20Rag.mp4...
A Polyphonic MUSICBOX on PIC 18F57Q84 using a sound sample as audio source. Exploring GCBasic programming , I decided to try and make a musicbox. It resulted in a polyphonic one and can play up to 8 independent voices simultaneously. I was asked to make a demo video and figured that 3min of a PIC chip just laying on my desk was kind boring to look at, so I added a LED-bar that shows when the voices are sounding. Here is a demo video: -Maple Leaf Rag by Scott Joplin (Public Domain). https://lineaudio.se/div/Musicbox%20Maple%20Leaf%20Rag.mp4...
A Polyphonic MUSICBOX on PIC 18F57Q84 using a sound sample as audio source. Exploring GCBasic programming , I decided to try and make a musicbox. It resulted in a polyphonic and can play up to 8 independent voices simultaneously. I was asked to make a demo video and figured that 3min of a PIC chip just laying on my desk was kind boring to look at, so I added a LED-bar that shows when the voices are sounding. Here is a demo video: -Maple Leaf Rag by Scott Joplin (Public Domain). https://lineaudio.se/div/Musicbox%20Maple%20Leaf%20Rag.mp4...
Champion ! Thank you
Ok. The easy way. Reinstall and select legacy mode. This should select the old/legacy editor.
I really need to find out how ro install GCB@Syn GUI on my laptop. I havr insralled GCB Studio but I need to install or fid out how to switch it on.
Thanks!
Again, very nice, See https://github.com/GreatCowBASIC/Demonstration_Sources/tree/main/Time_Based_Task_Switcher_Solutions/Thallium%20-%20an%20AVR%20%20preemptiv%20%C2%B5RTOS/Button_control
Hi, I've written four different program examples for button implementation with Thallium: 1.) The action occurs immediately upon pressing the button. 2.) The action occurs when the button is released. 3.) The action occurs immediately upon pressing the button, and there's a repeat function. 4.) The action occurs when the button is released, and there's an on/off function. Each example is available for the AVR128DA28, ATmega328PB, and ATmega2560 chips. Because there are 12 files, I've bundled them...
Im a little confused here. tou say "not be using the bootloader at this stage" is that is the TinyBootloader+ ? Yes, but, this is general advice for any bootloader. What Terminal pregame tool should I be using if not TBL+ ? Yes, as you showed in this post. https://sourceforge.net/p/gcbasic/discussion/579126/thread/9592e36540/a854/attachment/Capture5.JPG Using the PicKit3+ Tool keeps switching the 3.5v to 5v and putting the Code and Data Protect on and will not allow me to turn it off This could be...
Im a little confused here. tou say "not be using the bootloader at this stage" is that is the TinyBootloader+ ? What Terminal pregame tool should I be using if not TBL+ ? Using the PicKit3+ Tool keeps switching the 3.5v to 5v and putting the Code and Data Protect on and will not allow me to turn it off
Im a little confused here. tou say "not be using the bootloader at this stage" is that is the TinyBootloader+ ? What Terminal pregame tool should I be using if not TBL+ ? Using the PicKit3+ Tool keeps switching the 3.5v to 5v and putting the code and data on and will not allow me to turn it off
Im a little confused here. tou sa "not be using the bootloader at this stage" is that is the TinyBootloader+ ? What Terminal pregame tool should I be using if not TBL+ ?
I would not be using the bootloader at this stage. So, flash the I2C_Scanner.gcb following the guide. The guide addresses not using a bootloader initially to get the i2C scanner working.
Complete Rip up and restart. It MUST be something stupid that I am doing wrong. I cannot remember PikKit3+ throwing an error on verification (please see attachment) The 16F18346 is brand new unused.
How you getting on with I2C discovery ? Did you see the new guide? specifcially the change to the Terminal software.
I really do recommend sticking with GCCode, The next release will include a debugger and that only works within GCCode. And, many of the functions are not available in the old unsupported editor.
Thanks! I've noticed that I have to think for a long time, every time the program needs to queried a single button at a port. Therefore, I will publish some templates about this today or tomorrow.
I have installed GCB Studio on my Laptop but how do I access GCB@Syn GUI? I am very familiar with that and feel as if I can walk around it with my boots on. I have asked this previously but I didn't receive a definitive answer.
Very nice work. I will download and move to GitHub, Thus will then include in the demonstration distribution.
Hi, I am pleased to announce the completion of four new files for Thallium today. These consist of porting the Thallium core to the ATmega2560 controller and adapting the corresponding application examples. Cheers Ralf
This has nothing to do with the IDE as this. Stay with the IDE you have as this is what we can support.
New item 26 added to the guide.
Screenshot as requsted
Share the screenshot of the terminal application.
I have followed your latest post (I2C Scanner)down to a T and I'm still getting gobbledygook repetitive hex characters output on my terminal which is beginning to make me think its my PC or the terminal program corrupting the data. Anyway, to ensure that my obscure theory could be right, I mounted the instance of GCB Studio from Angel onto my laptop, which leads me to my question. How do I access GCB@Syn GUI? I am very familier with that and feel as if I can walk around it with my boots on. Thank...
Back to first principles. Your program is using PPS which was stated at step #1 not to use. You need a clean PPS. Attached is a new guide. And, a totally new program. This has the same instructions as the guide but it is real code. It has all the steps. Use this. This must work before you introduce PPS. This has a step be step process. This uses no PPS and outputs the results to the serially attach Terminal. Please start with this guide and program.
Fix: Language file corrections
This may help you. GCBASIC Trigonometry Functions (Sine, Cosine, and Tangent) GCBASIC provides fast, integer-only trigonometric functions using lookup tables. They work with whole-degree angles (no radians or fractions) and return scaled integer results — no floating-point library needed. Available Precision Levels Include File Decimal Places Scale Factor sin/cos Range tan Range (near ±90°) Approx. Table Size #include <trig2places.h> 2 ×100 –100 to +100 up to ~32767 ~270 bytes #include <trig3places.h>...
Thanks for the help Anobium, yes it works fine, its just that I would have liked to know what that Sin and Cos stuff is doing. I will have a look at the help files.
/* An I2C discovery program for GCGB and GCB. This demonstration examines the I2C/TWI devices attached and displays then devices discovered on a serial terminal and/or LCD using the primary I2C module. You will to connect I2C/TWI devices to the I2C/TWI ports - there will be two of them. ' The data and clock lines respectively. The two lines are need to be pull high by suitable resistors supply voltage. You will also need to connect a serial Terminal to serial port. Using PUTTY.EXE for an excellent...
What is the source code?
Partial Success. I think I have some settings wrong in the GCB Terminal application.it is spewing out the first six stings of data thrn repeating the same
No, there isn't really a single official "Humpty Dumpty" (super-simple, foolproof, step-by-step) guide specifically for the I2C Discovery demo in GCBASIC — the closest things are the YouTube videos (like "GCBASIC: I2C Discovery" and the PT11 one for a different chip family showing the process), plus the general I2C sections in the GCBASIC help file. Most users just load the demo from the Demos directory in GCStudio or the installation folder and run it. That said, the I2C Discovery tool is one of...
There is a range to Sin(). Your random number must not exceed the range of mathematical Sin(). See the Help. From the photo ..did you get working?
Is there a “humpty " guide to using the I2C Discovery application from the Demo’s Directory? I ask this as the very many times I used this very useful application I just cannot get it to respond in the SynWrite Terminal. I'm using TBL+ on a PIC16F18346 with a 4 X 20 LCD on the I2C Ports as in the attached image
Sorry for posting 100 times, I was not sure if it posts or what. The 100 hits and misses were like this, I put random numbers in the 2 equation's and then compile it, load it into the pic and see what happens on the screen, until it was coming right, took quite some time.
All sorted now. I'm back home - Many Thanks
Hi Keith, did you are experiencing problems with the SourceForge download? There you go, this is a direct download from our own GCBASIC servers: GCStudio Setup Angel
Thank you for update!
A simple Tron type game against the uno.It uses a function written by Evan Ven to see if a pixel at a particlar x,y position is lit. https://youtu.be/h6dbkNzyfPY ;UNO Tron game on 1" GLCD by Stan Cartwright.Function ReadPixel_SSD1306 written by Evan Venn. ;Player starts on screen right and initially moves left ;CPU starts on screen left and initially moves right ;4 buttons for up/down/left/right from VSS to UNO D7 to D4 and pull-down resistors ; ----- Configuration #chip mega328p,16 #option explicit...
Fix: Fix: Resolve DATA BLOCK handle of BYTES when a word table for 16F
I think I can answer but what do you mean by 100s of hits and misses?
A Voltmeter with a GLCD 240x320 with a ili9341 chip, thanks to Stan and Anobium for the original code. Can someone please explain how this part of the code works, I managed to make it work on the bigger screen, but with hundreds of hits and misses: sub plotdial xend = 166 + radius * sin (angle)/185 yend = 165 - radius * cos (angle)/185 pset (xend,yend,0XFFE0) Here is the working code on a BIG screen '''You can change the microcontroller, the GLCD and the analogue port. '''To change the microcontroller...
Thank you. More great examples. I have updated GitHub.
Hi, Unfortunately, there was still a bug in the oscore.h files. The macro 'signal' wasn't working correctly. The bug has now been fixed. The updates are attached. I've also finished a small demo program for the 'signal' and 'passed' macros. It shows what happens when two tasks simultaneously use a USART to output text, both with and without the macros. The demo programs are attached. Cheers Ralf
Resolved on build 1568. :-) Fingers crossed Fix: Resolve DATA BLOCK handle of BYTES when a word table Fix: Ensure DATA BLOCK tables are ALWAYS in Progmem space ( silly warning being issued) Fix: Ensure alignment of DATA BLOCKS tables Fix: Ensure DATA BLOCKS table(s) are not treated with lookup subroutine ( was double entry in ASM ) as regular tables.
Fix: Resolve DATA BLOCK handle of BYTES when a word table
@angel-spartan Please share an alterative dowload URL
We have a bug. GCASM is not producing the correct HEX for TABLE data only with TABLE data is a DATA BLOCK. I will fix asap
We are not thinking this through. The correct instruction... best explained as Dim dataaddress As Word = 3 #Define DATASIZE 2 Programread (@sekvens1+( dataaddress * DATASIZE ), aaa) The data address is word in length of if you want data point 3 ... 3 * 2. NOTE: No need for the Sun Programread - everything works as expected. See the attachment for the new debugger screen in GCODE!!! I resolved this in the new debugger.
Check your emails please.
If I change the data block to 256, 256, 400, 500, 700, 1100, 1200, Somethings rolls over and Programread (@sekvens1+( 3*2 ), aaa) returns 500 If the data block is: 100, 255, 400, 500, 700, 1100, 1200 Programread (@sekvens1+( 3*2 ), aaa) Then I get 700 So if the numbers are greater than 255 it seems to work, but when less than 256 some shift occurs.
Nope. I tried that and now retried with and without again. Same result. Mathwise I don't see the difference and GC basic doesn't seem to treat it differently either as far as I can see. I even tried coplying your line above. Programread (@sekvens1+( 3*2 ), aaa) Returns 700 Should be 500? Programread (@sekvens1+(0*2), aaa) //Get first word returns 65380 (not 100 as inserted into the data block).