Post Reply 
HP48 interfacing sensors ovr RS232
05-13-2024, 12:54 PM
Post: #1
HP48 interfacing sensors ovr RS232
The idea is quite simple:

The electronic part is a mcu like pic, arduino, mega32 etc. which connects to the sensor on one side and on the other side to the HP48. The J or K type thermocoupler need an amplifier and a more sophisticated a/d converter, arduino only supports 10Bit resoulution. An amplifier shifts the voltage from the sensor (-0.3 to 0.6 eg) in a suitbale range for the arduino (0 - 5V)
However the RS232 part is realized with a MAX232.

I case you want to turn on a pump or light i have added a ULN2003 transistor array which triggers a solid state relay, if you need more power.

For temperature measuring i use i2C sensors, but there is a line length limit of about 30cm on the I2C bus, yes you can extend it with bus expander PCF8574 or similar.

A more practical example:

When I needed to take the characteristics of a 5 cylinder 4-stroke model engine (Moki 250) i took 5 simple PT1000 (with opamp) thermocouplers. They can be extended up to 3m.

The software is simple as well. The mcu polls the serial line or has an serial interrupt and reacts on simple commands like:

ON1 => Digitalportpin 1 on
IN4 => read Analogport 4, returns 0...1024
PWM128 => Set PWM to value 128 (dutycycle 50%)
MSGthis is an test => sends message to the display "this is an test"

I always send the delimiter / prefix CHR(13) ...

The mcu then prepares the pins, reads the data sends the data to the HP48 with an "OK" as ACK.

The HP48 uses standard commands like XMIT, BUFFER, SRECV, STIME etc.
The serial line works with 9600 Baud, which is fast enough in most cases.

The software on the HP48 can make a defined amount of readings, set a repeating or non repeating alarm. This is a simple datalogging feature.

I used it to make characteristics of thermocouplers, transistors and other components. The data will be stored in an array and further processed. Plotting graphs or mathematical regressions follow.

I made a simple menue to configure the needed input vlaues with the fantastic menue enhancement in systemPRL from Raymond delTondo, which I use with most of my programs.


Here is a ATMEGA8 I2C LM75 portable single temperature interface.
(written in assembly language)
[attachment=13537]

Ralf

I have rwritten the HP48 software, that it does not use any specials.

Enter the counts of measurements, the intervall (if it is zero than it makes counts measurements, if it is >0 then it uses repeating alarms executing a program every intervall minutes)

New data is a flag to delete the data series or continue reading.

Here I am reading a PT1000 temperature sensor from an analog port of the mega8

LOGT, the main program
PT10T, the subprogramm for setting the repeating alarm
PT10 the subprogram, that communicates with the interface

PHP Code:
Mainprogram LOGT

« 
"MEASUREMENTS:" {":COUNTS:
:INTERV:" 
1
INPUT OBJ→ OBJ→
DROP SWAP OBJ→ DROP SWAP
CLLCD 
"NEW DATA?" 3
DISP 
"" "" "" "" "YES"
"NO" 
TMENU
  
DO -1 WAIT
  UNTIL 
16.1 15.1 }
SWAP POS
    
IF DUP
    THEN 1 
1
    
ELSE 1420 .074 BEEP
    END
  END 0 MENU 0 → COUNT
INTER TRUE EN
  « CLEAR CLLCD
"PROCESSING..." 3 DISP
TRUE
    
IF ==
    
THEN CLΣ
    
ELSE NΣ 'EN' STO
    END COUNT INTER DUP
    
IF >
    
THEN SWAP 'COUNTER'
STO 0 'EN' STO CLΣ DATE
TIME .05 HMS
'PT10T' 4
PICK 8192 
60 4 →LIST
STOALARM CLLCD
"ALARM ACTIVE..." 3 DISP
2 WAIT
    
ELSE DROP 0 SWAP
      
FOR I I EN PT10
SWAP DROP 2 SD 3
        
IF ==
        
THEN →ARRY Σ+
        ELSE 
DROP DROP
        END
      NEXT
    END
  »
»


Subproram 
for using in repeating alarms PT10T

« → ALN  « CLEAR CO
UNTER DUP    
IF >
    
THEN 'COUNTER' 1STO-
 
PT10 SWAP DROP 2 SD 3
   
IF ==      THEN →ARRY
 Σ
+      ELSE DROP
END
    
ELSE DROP ALN
DELALARM 
"LOG FINISHED"
3 DISP 2 WAIT
    END
  »
»

Subprogram 
for polling PT10
« CLOSEIO 
"AD1
XMIT 1WAIT BUFLEN DROP
  
IF ==  THEN 4 SRECV
DROP OBJ→100 377 
DUP R
OT 
SWAP 103 * -  END» 

/41/48/
Find all posts by this user
Quote this message in a reply
05-13-2024, 02:57 PM
Post: #2
RE: HP48 interfacing sensors ovr RS232
Great!
Thank you.
Can we ask a favor from the Admin to move the post #13 and on from
https://www.hpmuseum.org/forum/thread-21676.html
here?
Find all posts by this user
Quote this message in a reply
05-14-2024, 01:28 AM
Post: #3
RE: HP48 interfacing sensors ovr RS232
(05-13-2024 02:57 PM)9aplus Wrote:  Can we ask a favor from the Admin to move the post #13 and on from
https://www.hpmuseum.org/forum/thread-21676.html
here?

There does not seem to be a way to move only some posts to an existing thread; they can be moved to new thread, but that won't give you what you want.

So probably the best solution is to include links in your messages in this thread to the relevant messages in that thread in the Classifieds Forum.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
05-14-2024, 10:01 AM
Post: #4
RE: HP48 interfacing sensors ovr RS232
Thank you for clarification.
We can continue as is.
The link is already above.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)