HiTech-C and the PIC18F26K22

I have been using HiTech-C with great success on the PIC16F series chips.  So, when I moved to the 18F series, I tried to stick with it. But, I hit a few problems…

The new PIC18F25K50 chips aren’t supported at all.

So, I tried the supported PIC18F26K22…  Some things do work, but the string libraries don’t seem to work… so, might as well just ditch this, as the PIC18 version of the compiler hasn’t been updated for a long time, I expect that Microchip may be abandoning this in favor of their new C18 compiler.

Tags:

Microchip PIC18F25K50 compiler problems

After using the 16F series and some of the simpler 18F devices, I picked up some of the PIC18F25K50 microcontrollers. 

I found that the HiTech-C compiler doesn’t support the K50 series at all, so I switched over to the C18 compiler.  I can get the code to compile in C18, but it won’t link.  It turns out that Microchip messedup the toolchain and didn’t include the necessary libs in version 3.45.

The only thing to do is pack up those chips and wait another 6–18 months for Microchip to pull their thumb out.

 

 

Bark Controller

Device to discourage dogs from barking

Vision:

One or more remote controlled devices(annunciators) which will emit a high frequency audio pulse.  One or more remote transmitters that can trigger all remote annunciators simultaneously.


Principle of operation:

  1. Transmitters will use the 315MHz ISM band.  The transmitters will all use the same address/code.  Matching ISM receivers, all set to the same address/code.
  2. The audio frequency is not critical, and will sweep across a range of 18 – 22 KHz.  
  3. The audio will be generated by a PWM from a microcontroller.  
  4. The audio burst should be 3-5 seconds in duration.
  5. The PWM signal from the microcontroller will be sent through a 2N2222A to a piezo speaker with a parallel inductor to boost the voltage.
  6. The device should be able to run on 5 VDC.
  7. The device does not need to be battery powered, so standby power consumption is not critical.


Components:

  • RF remote transmitter:  keyfob remote from Adafruit.com – based on the PT2262
  • RF receiver:  Simple RF T4 momentary from adafruit.com – based on the PT2272
  • Picaxe-08M2  – why?  had one laying around
  • Speaker:  piezo tweeter
  • Power Supply – 5V USB plug-in

Circuit:

Bark_schm_f

Screenshot of output, note the 50Vpp output:

Bark_scope1Here’s the code:

; Bark Controller
;  initializes LED and Piezo to OFF
;  waits for a signal
;   when a signal is received:
;   turn on LED
;   step through a set of 3 tones, 10 times
;   turn off the LED
;   turn off the sound
;   wait a couple of seconds
;
; Tones to play:
;   frequency 18Khz = pwmout C.2, 55, 111
;   frequency 20Khz = pwmout C.2, 49, 100
;   frequency 22Khz = pwmout C.2, 44, 91

low C.4 ;LED is C.3 = PIN 2
pwmout C.2, off  ;Piezo is C.2 = PIN 5
do  ;input is C.3 = PIN 4

if pin3 = 1 then
 high C.4 ;LED on
  For b0 = 1 to 10
pwmout C.2, 55, 111 ; 18Khz
pause 100  ; play for 0.1 seconds
pwmout C.2, 49, 100 ; 20Khz
pause 100
pwmout C.2, 44, 91 ; 22Khz
pause 100
  next
 low C.4
 pwmout C.2, off  ; turn off the piezo
 pause 2000
endif

loop

 

SPI decoding on a Rigol DS4024

Tried out the SPI decoding capabilities of my new DS4024.
Very nice! It took a little playing around to figure out the settings. Since SPI isn’t completely standard, you need to make sure that the high/low option is correctly configured for each channel.
The picture doesn’t really do justice to the crisp image on the screen.  Click the image below to zoom in for a clearer view.  The screen is non-glare, but the camera seems to pick some up (more than I can see).

Spi_1

 

The DS4000 series oscilloscopes are big. Compare the 4000 to the DS1052E on the shelf above it.

Scope_sizes_1

Spi_2

Multimeters

Various meters over the years.  The probe type meters sound more useful than they’ve really been. 

Bench meters:  BK 5491B, Agilent 34410A, Rigol DM3068

Hand held:  Fluke 289, Sinometer IT803, my 23 year old Metex M-3650B, BK 2709B, Extech430 & 505, BK 879B

Bottom:  A couple of probe meters

Meters

Radio Tower Navigation Lights

Yesterday, I received a small box of junk in priority mail.

Nav_parts Nav_box1

The lights weren’t working on a 400 ft. radio tower.  The controller’s enclosure was damaged and water had gotten in. 

The board had a fair amount of corrosion, and also some scorch marks. 

Nav_board_top1  Nav_board_bottom

It looks like there may have been some transients from lightning, as the leads to one of the MOVs has melted.

Nav_burn1 Nav_mov1

I toned out the connections, and it matches the typical NE555 oscillation circuit.  The damage was mostly limited to the MOVs (150L20), and the TVS protection diode (1N6281C).  But, before the TVS blew, it took out a couple of traces on the board.  So,I just bodged in a couple of wires to repair the trace, and it’s all running again.

Soldering Irons

BlackJack SolderWerks BK-3000LF

BK3000lf

Last spring I had picked up a pair of BlackJack SolderWerks BK3000LF soldering stations with a couple of extra tips in different sizes.  These have worked pretty well for the price (around $39 each at the time) and the control units stack conveniently to save space.  But, they have trouble maintaining temperature when using desoldering braid… or even without using braid, they won’t really maintain temperatures above 360 C.  Also, there aren’t any tips that work well for SMDs.
The price has gone up quite a bit in the past year, so I’d be a lot less inclined to get these now.  The only place to get them, or any tips, appears to be from CircuitSpecialists.com.  If they decide not to carry it, then I’m out of luck for parts.

Hakko FX-951

FX951
So, I recently looked at the Hakko units.  The FX-888 is a well made unit (see this hack at the eevBlog), even though it looks a bit like a toy.  I also liked the FX-951, with the digital display.  The 951 series is more of a professional unit, even though it too has the bright yellow and blue colors.  There’s a huge selection of tips, and you can get extra snap-in grips which makes it easier to change the tips while they’re still a bit warm.  The cables on the Hakko are thinner, more flexible, and a bit longer than on the BK-3000LF.

For most purposes, I’d generally go with the FX-888, it’s a great unit at a decent price. Hakko makes a variety of tips available from multiple sellers.

Why two soldering irons?  I found that I often need two sizes during the same work session.  When building a board I’ll use a small bent tip for surface mount devices, and a larger bevel tip for through-hole components and wired connections.  When salvaging a board I often need a small tip to get some components, but for many I need to use a large tip with heavy desoldering braid.  So, having two irons available is very convenient.  And, if they are similar models, I can share the tips between them.

Hakko-Tips

 I have found great prices on tips and handles (and stunningly fast shipping) from All-Spec.com

I’ll see about doing a teardown of both the BK-3000LF and the FX-951 when I can.

Voltage References

So, how do you know if your multimeter is giving you the right readings?  The readings might have been correct (within spec) when it was new, but what about 6 months, or 20 years later?  There are a plenty of expensive devices (not to mention calibration services) on the market to check equipment, but what about low-cost/hobbyist level?
Here are a few options from 2 sources:
Source:  VoltageStandard.com
  has several options, a couple of these are reviewed here:
DMM-Check $35.50  http://www.voltagestandard.com/DMMCheck.html
PentaRef $56.00  http://www.voltagestandard.com/PentaRef.html

Source:  GellerLabs.com
Geller has two units, the one reviewed here is the SVR and it is readily available.  The other unit,  LNVR, is significantly more expensive and is more of a special order item.
SVR  http://www.gellerlabs.com/SVR%20Series.htm  $39.95
LNVR  http://www.gellerlabs.com/LNVR%20Series.htm  – special order

A month ago I had tested all three references and they appeared to be very accurate.  I received a new, calibrated, Agilent 34410A DMM and decided to retest the references.  The SVR and the DMM-Check both appeared to have remained accurate, but the Penta-Ref was a different story.
The Penta-Ref had been quite accurate on 2/21/12, when I checked it with a borrowed calibrated Agilent 34401A.  But, on 3/20 with a new 34410A it seemed off.  The next day I thought about it and checked the two 9-volt batteries which power the Penta-ref… sure enough, they were running a bit low.  With the Penta-ref switched on, the battery voltages were 8.92 and 8.97.  I replaced them with brand new batteries (9.6volts) and re-ran the tests.  That fixed it, the Penta-ref was back on track.

On a similar note, the Geller SVR provided a steady 10.0000 volts output using an input voltage as low as 10.945V.

Geller SVR 23.5° C
Value 34410A Fluke 289
10 Volts 10.0000 10.000

Penta-Ref
New batteries 22° C Old batteries 23.5° C
Penta-ref Setting 34410A Fluke 289 34410A Fluke 289
0.2500 0.25013 0.25013 0.25426 0.24543
0.4900 0.49007 0.49009 0.49821 0.4983
0.5100 0.51009 .51012 0.51855 0.5186
4.9000 4.9001 4.9004 4.9817 4.982
10.0000 10.0000 10.0001 10.1666 10.167

DMM-Check 23.5° C
Value 34410A Fluke 289
5 Volts 5.0002 5.0006
1 mA 0.99994 1.003
999.4Ω 999.23k 999.3k
9.996kΩ 9.9961k 9.999k
99.97kΩ 99.976k 99.99k

 

 –  –  UPDATE 4/2/12 –  – 

 I was contacted by Doug Malone of VoltageStandard.com, he noticed this post and felt that the Penta-Ref should not experience a problem with the battery levels that I listed.  He requested that I return it for adjustment/repair.  So, I’ve sent it, and the DMM-Check to Doug for calibration.  I’ll post new results when I get the units back from Doug.

That’s great customer service!

Also, it looks like there’s a new model coming, the DMM-Check Plus.  It will include a 5VAC rms voltage reference,  1mA rms AC current reference, 100Hz precision frequency source, and 0.1%, 10ppm 100OHM precision resistor

 – – UPDATE 4/10/12 – –

I mailed the units back USPS on the evening of 4/3, and received the recalibrated units on Monday 4/9, that was fast!  I let them sit on the bench overnight to acclimatize before testing. 

To test the drop-out voltage on the PentaRef, I temporarily replaced the batteries with 2 isolated bench power supplies.  The PentaRef provided stable accurate output, identical to the battery readings (below) when run at voltages from 9.5V down to 6.5V.  It did not matter if one supply was set at 6.5V and the other at 9.5V, the reference output remained the same.

Test setup:

  • All tests were performed at  21° C. 
  • The Agilent 34410A was set to manual range for each test, with NPLC set to 10, and nulled. 
  • The Fluke 289 was also set to manual ranging and nulled for each test. 
  • One pair of Agilent probes was used for all tests, and was moved between meters for each set of tests.
  • The PentaRef and DMM-Check units were powered by fairly new 9V batteries, providing 9.2V under load.  The Geller SVR was powered by a Rigol 1308A set at 15.00 Volts.
Geller SVR
Value 34410A Fluke 289 notes
10 Volts 10.00005 10.001 within meter’s spec

Penta-Ref
Setting 34410A Fluke 289 notes
0.2500 0.250036 0.2500 well within device spec of 0.2%
0.4900 0.489981 0.4900 well within device spec of 0.2%
0.5100 0.509995 .5100 within meter’s spec
4.9000 4.89989 4.9001 within meter’s spec
10.0000 9.99986  10.000 within meter’s spec

DMM-Check
Value 34410A Fluke 289 notes
5 Volts 4.99994  5.0001 well within device spec of 0.01%
1 mA 0.999923 1.000 well within device spec of 0.1%
999.2Ω 999.231Ω 999.2Ω
9.996kΩ 9.99605k 9.996k
99.97kΩ 99.9746k 99.97k

 

Summary

Based on the results above, all tests fall well within spec.  The Agilent has exceptional accuracy and resolution, and may make it appear the the voltage references aren’t spot on.  But, we have to account for the device’s rated accuracy, compounded by the accuracy of the meter.  So, in these tests, “Within meter’s spec” means that he reading is so close to the specified voltage that I can’t tell if the generated voltage is precisely correct  (Example:  specified value is 0.5100 volts, I measured 0.509995 Volts.  The meter’s accuracy for that reading is +/–  0.000016 volts, so the device may be producing exactly 0.510000 volts, but I can’t be sure).

 

 

« Older Entries Recent Entries »