Sub PORT_OUT(byval port as ushort, byval _data as ubyte) ''int ioperm(unsigned long from, unsigned long num, int turn_on) ĭeclare Function ioperm Alias "ioperm" (ByVal from as uinteger, byval num as uinteger, byval turn_on as integer) as integerįunction PORT_IN(byval port as ushort) as ubyte Sub PORT_OUT (ByVal PortAddress As short, ByVal Value As short)ĭeclare Function PORT_IN Lib "inpout32.dll" Alias "Inp32" (ByVal PortAddress As short) As shortĭeclare Sub PORT_OUT Lib "inpout32.dll" Alias "Out32" (ByVal PortAddress As short, ByVal Value As short)
Note that with IRQ0 disabled Sleep failed to respond to key presses, so I had the use ^C to terminate the app.ĮDIT: Even after a switch to Intel syntax for the -gen gcc code I still could not find any syntax that wouldĬause FBC to set up an EBP-relative access to tsc1 in inline assembly, so I still needed to share tsc1:Ĭode: Select all '''''''''''''''''''''''''''''''''''įunction PORT_IN (ByVal PortAddress As short) As short If I uncomment the code that disables IRQ0 and recompile, then the minimum and maximum periods are consistently 133 and 168, equivalent to ~0.3 microseconds for the maximum. The system does not stop responding during the test, and if I continuously drag the app console around the desktop during the test the maximum increases to ~4600000 cycles.Ĭompiled as a DOS app and running under MS-DOS 6.22 + HDPMI32 on the P3 system, the minimum and maximum periods are 133 cycles and ~4700 cycles, equivalent to ~9 microseconds for the maximum. This also is on a system with an active Internet connection, and these values are reasonably consistent even while I’m running a scan of the hard drive. Running under Windows XP SP3 on a 3.0GHz P4 Northwood system, nominally a single core processor but with Hyper-threading, the minimum and maximum periods are ~370 cycles and ~4000000 cycles, equivalent to ~1.3ms for the maximum. Running on this single-core system, during the test the mouse cursor freezes and the system stops responding. This is on a system with an active Internet connection, and these values are reasonably consistent even while I’m running a scan of the hard drive. Running the above code, compiled with -gen gas or -gen gcc, under Windows XP SP3 on a 500MHz P3 system the minimum and maximum periods are ~130 cycles and ~800000 cycles, equivalent to ~1.6ms for the maximum. If period < minimum then minimum = period If period > maximum then maximum = period '' Log the minimum and maximum loop period, in clock cycles, for COUNT loops. 'in al, 0x21 '' get interrupt mask for PIC 1 '' cause FBC to set up an EBP-relative access to them in inline assembly.ĭim as uinteger period, maximum, minimum = &hffffffff '' These shared because for -gen gcc I could not find any syntax that would SetThreadPriority( GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL ) SetPriorit圜lass( GetCurrentProcess(), REALTIME_PRIORITY_CLASS ) SetProcessAffinityMask( GetCurrentProcess(), 1) '' Restrict process to a single core and set highest possible priority.
My problem lies in the visual presentation: I d'ont know how to hide the console commands in c + + of engines or cameras that use threads: It was my recent request for assistance. If you visit my site you will see some applications all written in FB and in C + +, obviously using threads. It only remains to decide how to handle (interpolation) shortages due to interruptions Windows. They are random and sometimes very long (a few hundred milliseconds).Ī trick makes it possible to counteract this fault : for example measurements are transferred to a RAM disk and then we just query the date of writing on this ramdisk (a c++ program) which is known to the millisecond. The problems come from Windows interruptions.
Connections use either USB or ethernet associated with an optical fiber if the distance between actuators and PC is too long.
Acquisitions and commands are programmed in C + +, because thes actuators, camera, etc are sold with their drivers (dll.).Īll treatments (signal processing, statistics, actions,decisions) are performed in FB Windows. I use this wonderful FB for 7 years for all my industrial applications. I answer your question about using FreeBasic in cnd.