Omnimaga
Calculator Community => Other Calculators => Topic started by: LincolnB on July 20, 2011, 07:45:00 pm
-
I have two questions, aptly-stated by the title of this thread. My first question is about using the global CALCnet client program I downloaded from Cemetech.net http://www.cemetech.net/programs/index.php?mode=file&path=/win/gcnclient.zip. Reading through the included readme-style PDF document, I understood basically how it works.
I’m trying to connect my calculator to the internet using Gossamer and the gCn Client software. To get to this work, the way I understand it, I need to run the gcnclient.exe program with some command line arguments.
What exactly are the arguments that I would need to type in the command prompt to get it to work? So far what I have is :
>gcnclient.exe -n WebHub
-l (don’t know what to put here)
-s (no idea)
-p 4295
-d direct (not sure if this works yet)
(Obviously without the carriage returns)
So yeah. That’s what I would like cleared up about that.
My second question is, how do I make use of interrupts in Axe? What is some example code where interrupts would be useful? I kind of understand what interrupts are, but not completely.
Thanks.
-
Interrupts are triggered by hardware every ____(you can set the frequency) of a second. When interrupts occur, the CPU switches from executing code where ever it is currently executing to where the interrupt code is. A good usage would be as a timer, as it is called at consistent times, regardless of how much code is executed around it.
-
Interrupts are basically events that are triggered every few assembly instructions, at a call frequency defined by the second argument of fnInt(. The first gives the subroutine to be called every few cycles, the second is the speed. Example:
fnInt(LOL,0)
Lbl LOL
Disp "LOL"
Return
The word "LOL" will be displayed every few cycles.
-
So if I did:
fnInt(LOL,5)
then the code at Lbl LOL will be executed five times every second, or every 5 assembly instructions?
-
It's not 5 times a second. It might be every 5 instructions. Maybe it's every 5 CPU cycles. I can't remember off the top of my head.
-
About what does the frequency have to be if you want some code to execute once every second?
-
FnInt(LBL,FREQ) Turns the subroutine into an interrupt and then turns interrupts on. The frequency can be (fastest) 0, 2, 4, or 6 (slowest). L2 is used for interrupt data so do not use L2 for storage when using interrupts.
http://eeezor.ec3club.tk/Files/Resources/program%20readmes/Axe/Commands.htm#Int
Seems to me the same thing Desolate has? :P
-
Although you can specify whatever number you want for the second argument, fnInt()'s second argument is always ANDed with 6. This means that the only meaningful second argument values are 0, 2, 4, and 6. The interrupts will then run at a frequency according to the chart below:
Freq argument | 83+BE Freq | All Else Freq |
0 | 560Hz | 512Hz |
2 | 248Hz | 227.55Hz |
4 | 170Hz | 146.29Hz |
6 | 118Hz | 107.79Hz |
-
Do you know how I might set up an interrupt to do something once every second?
-
You would need a counter. Then, set it to 0, and when an interrupt is called, increment the counter. If the counter equals a certain value, then reset it and execute the code.
-
count the number of calls. When the interupt routine has been called 118 times at frequence 6 on a 83+, then do something
Example:
.timer
0->A
0->B
fnInt(INT,0)
Repeat GetKey(15)
End
lnReg
lbl INT
A+1->A
Return!If A=512
B+1->B
Disp B
0->A
Return
-
The DS<( command can be useful for running an interrupt at a low frequency. On non-83+BE calcs, enclosing all the code in a subroutine running on a 512Hz interrupt with DS<(I,512) can be used to execute a block of code exactly once per second:
512→I
fnInt(I,0)
.Main program goes here
Lbl I
DS<(I,512)
.1Hz interrupt code goes here
End
Return
However, on the 83+BE, the timers aren't exact, so don't expect to be able to pull off perfect timing on it. If you're not using the timer for precise timing, you can use the following code. This solution should create an ~1Hz interrupt on any model:
fnInt(I,6→I)
.Main program goes here
Lbl I
DS<(I,{Full+1+Data(108,118)})
.1Hz interrupt code goes here
End
Return
-
Thanks for the help, this is pretty awesome information.
Can anyone answer my gCn client question?
-
Can anyone answer my gCn client question?
Maybe you could try asking on Cemetech? They know a lot about gCn.
-
If you're on Windows, you'll also need to install the filter driver. Get libusb-win32 at http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.4.0/libusb-win32-bin-1.2.4.0.zip/download (http://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.4.0/libusb-win32-bin-1.2.4.0.zip/download), extract the .zip file, and run bin\x86\install-filter-win.exe
... <local_name> can be anything, but is often based on user name (I use "CalcHub", for example. The main idea is that you provide something unique.) You can ignore the -s and -p options almost always; they default to what's necessary to connect to the server Kerm's set up.
(To clarify: <local_name> refers to what's after -l.)
To use DirectUSB, you are correct in using "-d direct", but note that "-d d" also works and is shorter ;)
-
Thanks, I'll try that out as soon as I get on my primary computer.