Shared memory between a Prime Simulator and its Windows host (- and a loving beep!)
|
02-11-2023, 07:22 PM
Post: #1
|
|||
|
|||
Shared memory between a Prime Simulator and its Windows host (- and a loving beep!)
In a Windows environment, the Prime Simulator and its files typically reside at C:\Users\~\Documents\HP Prime\Calculators\Prime. These files can also be used to share ‘real time’ data between Windows and the Prime.
The design is such that the sender creates or appends to a data file, and the receiver retrieves and deletes that data file. The Prime and Windows can push or pull from this data file. For example, define PrimeOut as a Prime output file. In Windows, provide a program (per your favorite language) that pulls the PrimeOut file on a regular interval (i.e. once a second) and, if there is data, process that data. For simplicity, there is no effort to lock files, so a tiny window exists where potential data is placed in the data file and is deleted prior to processing that data (ensure a faster pull than a push, or use some semaphores/resilience here). The programs can push/pull and process your commands and data from websites and I/O ports to and from a simulated Prime. And you can continue to use HPPPL/CAS for quick prototyping external data sources. The following programs are available: Prime programs: ws_batch() Creates the batch files PrimeBeep.bat, PrimeIn.bat and PrimeOut.bat for Windows. Crude individual Windows cmd batch jobs are used here for transparency/demonstration, but any (C/Python/..) program which pulls/pushes/processes data can be developed for Windows. DataStreamer.AFiles() will show the three newly created Windows batch files in the directory “C:\Users\~\Documents\HP Prime\Calculators\Prime\&Data Streamer.hpappdir”. Beep() Will check/create PrimeBeep.bat if needed, and makes the Prime (tell Windows to) beep. It also will initially show the path/command to start the batch job (Edit>copy/paste into a Windows cmd!). PrimeIn() Retrieves data from Windows. PrimeOut() Sends data to Windows. PrimePull() Is an example of the Prime pulling the time and displaying the data from PrimeIn, i.e. fed by the timestamp from Windows PrimeIn.bat, or a Windows redirect such as ‘dir P*>PrimeIn’. Batch jobs in Windows: PrimeBeep.bat, PrimeIn.bat, PrimeOut.bat Now in Windows run PrimeBeep.bat and PrimeIn.bat file, each in their own individual Windows command window. PrimeBeep.bat will check for the presence of a file (PrimeBeep) and generates a tone if present. It will then delete PrimeBeep and repeat this process. PrimeIn.bat will generate a file (PrimeIn). It will place a timestamp in PrimeIn and repeats this process. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Shared memory between a Prime Simulator and its Windows host (- and a loving beep!) - gehakte_bits - 02-11-2023 07:22 PM
RE: Shared memory between a Prime Simulator and its Windows host (- and a loving beep!) - matalog - 01-20-2024, 09:25 AM
|
User(s) browsing this thread: 1 Guest(s)