If you're allowed to make changes to the design, consider using the PIC's built in comparator:
Attachment:
PIC comparator.JPG [ 101.66 KiB | Viewed 570 times ]
This is from the data sheet for the PIC16F887, which is used on the Rev D version of the Atom40-M. The earlier Rev B use the PIC16F877A. I provide the link to the -887 here for reference:
http://ww1.microchip.com/downloads/en/DeviceDoc/41291F.pdfAs you can see in the list of features, you can set this device (there are two) to "fire" on a preset voltage which can be supplied internally or externally. It also has the ability to produce an interrupt that will wake the PIC from sleep. So, you can now drop the processor into low-current mode and forget it; the comparator will wake it up. An added bonus is the comparator's output to a pin: connect this to a FET to activate the solenoid the instant the trip point is reached. The only "gotcha" with this is the comparator can oscillate as it nears the trip point, thus turning the FET on and off at a rapid rate, thus threatening to burn something out. If the sensor's output is rising slowly, this could easily happen, so you'll want to leave solenoid activation to the discretion of the processor.
If you want to monitor pressure on a timed basis, just use a timer to wake up the processor. And you can include an external switch to wake it up on demand as needed. Otherwise, just let it sleep.
None of these features is supported natively from the Studio compiler. However, you can set bits in the appropriate PIC registers to implement all these functions. The register names are stored away so you don't have to define them ahead of time. Just use conventions like
Register.1 = 0 ; we set the second bit of "Register" to 0
to define which bit to set in the register and the level (0 or 1) you want to set it to. You can even set entire registers using
Register = $FE (or 254, or %11111110)
Have a nice project.