maandag 27 juli 2009

Hello world on LCD

Last weekend I was able to display 'hello world' on the LCD screen using the LCD library provided by the Hitec C compiler. This library is for a LCD that uses the Hitachi 44780 controller.

The first attempt resulted in lots of rubbish on the screen. Reseting the processor resulted in different rubbish. It was not 100% rubbish though. Some parts of the words were readable. For example I saw 'wrd' it should have been 'world'. That was interesting, it seemed that some of the characters were skipped. That indicates a timing problem. So I added some additional delays in the Hitec LCD code. This solved the problem.

The code should be independent of the xtal frequency. Apparently it is not. My xtal is 18 MHz the xtal in the Hitec example is 4 MHz. Delays in the code take in account the clock frequency.
However, I found that some operations are not proceeded by a delay. That may be the problem or My LCD is just slow.

Thats good news. The bad news is that 33% of the programming attempts fail. The Winpic programmer frequently reports verification errors. Most errors are at high addresses. My PIC may be unstable. Maybe I 'll buy another one to check.

current activity:
Currently I am investigating the use of the PWM modulator to generate the ramp signal. I found an application note about using PWM as digital analog converter. It would be great to generate the ramp in software.

donderdag 23 juli 2009

Hello World

Last night I managed to execute the PIC version of hello world (blinking led) .
It runs on a PIC16F877.

I had to adapt the 16F84 code a bit. It would not run on the 877 without modifications but that was to be expected. The configuration word is different. The xtal frequency is different too.

Anyway I am ready to move to the next step. That would be adding the LCD display.

woensdag 22 juli 2009

small update

Not much progress to report.
I am building the micro controller board. It is ready for the first test. I'll try to make a led blink.
This time the 16F877 is used instead of the 16F84. I suppose it will work. Tonight I will try.
Meanwhile I found a LCD driver suitable for my LCD .Controlling a display will be the next step.
After that I'll add the rotary encoder.

ON4AIO suggested to use the AFC input of the tuner for small sweeps. The 1st LO must be at a steady at a fixed frequency. This is a good idea. I was a bit worried about small sweeps <1 MHz/div. The stability may be insufficient after all the tuning sensitivity (MHz/V) is large. Using the AFC for small sweeps relaxes some of the requirements. I'll give it a try but I will build start with the large sweeps first.

zaterdag 11 juli 2009

PIC programmer working?


I hope this is the last post about the programmer. It seems to work now.

The SERPIC has a connection between the programming voltage and the read data.
I suppose this was meant to test the presence of the programmer. However no other PIC programmers seem to support this. So I removed it.
After this modification I was able to program the PIC using Winpic. However the program did not execute. I don't think the modification was needed after all.

Reading back data from the PIC revealed that the first 4 words were missing. I also found out that those words were written correctly when the default configuration settings were used. That means watchdog on and RC oscillator. My hardware uses an xtal so that won't be usefull. Changing these setting by hand did not work. Winpic seems to use the first 4 words for the configuration. i will look in the PIC datasheet to find out if my assumptions are correct.

My program does not set the configuration bits Spp took care of that. So I did not set those bits. I don't even know how to do that using my old compiler.
The Hitec compiler can set those bits though. I made a program that turns on/off a led. The first instruction is to set the configuration bits. Finally I was able to program the PIC and execute my program.
The only disadvantage is that sometimes Winpic can not control the serial port.
Starting Winpic800 once solves this.

Winpic800 does not work. It can set the serial port pins but it just won't read data from the PIC. I might look into that problem once.

Now I will start making the microcontroller board.

dinsdag 7 juli 2009

more programmer problems

Those PIC programmer problems start to irritate me.

Last night I tried to program my PIC using an XP computer. The stuff I used:
Pentium 3 500 MHz PC
Windows XP no service pack.
SERPIC programmer , design David Tait
JDM programmer.
Winpic programming software.

The combination JDM programmer and Winpic worked fine. So the serial port can be used for programming PIC's Thats is a relief. I read that some people have encountered problems when using serial port PC programmers. So far so good.

Unfortunately the SERPIC was not supported by Winpic. The programmer can be selected but Winpic thinks it is a programmer that uses the parallel port. Winpic also supports PARPIC which is a programmer that uses the parallel port. PARPIC is also designed by David Tait. So I guess something is wrong in Winpic. The program is not maintained anymore so no updates can be expected. Fortunately the programmers can be defined by the user. So I defined SERPIC myself.

No luck, The programmer was not recognized by Winpic. Nevertheless I could manipulate the programming pins using Winpic so I gave it a try. No luck of course. Then I tried to find out how a programmer is detected. It is simply a loopback of dataout to data in. My programmer should be able to do that so I had another look at the hardware. I found a short circuit. After fixing that I was able to program the PIC. Unfortunately some instability issues popped up. Sometimes the RS232 pins don't work after starting Winpic. Sometimes the polarity of these pins are inverted.
Another issue is that Winpic hangs when a mouse is clicked during programming.

I have found another more recent program called Winpic800. Tonight I will give it a try.

I thought about using the JDM programmer for in circuit programming. It should be possible but it is tricky. Especially when an external power supply is used. The risk of destroying the serial port or the programmer is high. I could use relays to switch the PIC pins between programming mode and run mode. I may do that if I can not fix the problems with SERPIC.