Top Banner
03/25/22 David Conn VE3KL 1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886
15

11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

Dec 13, 2015

Download

Documents

Griselda Cain
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 1

OARC Microcontroller Club Project 2009Picaxe

PIC16F886

David
Page 2: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 2

PIC Project C ProgrammingPIC16F887

Develpoment Board Programmer

Dummy Load/Power Meter

Transmitter

PC

Page 3: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 3

Using Picaxe EEPROM 256 Bytes

►Used with the Keyboard►Used with the Power Meter

►EEPROM stores data that can be retrieved

Page 4: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 4

EEPROM 256 Bytes in Picaxe

Put data in EEPROM with the command:

EEPROM location,(data,data...)

Example:

EEPROM 0,(66,12,0,0,0,”V”) means

The number 66 is stored in location 0 of the EEPROM 12 is stored in location 1 zero's stored in locations 2,3,4 Ascii “V” is stored in location 5

-------------------------------------------------------------------;Read from EEPROMread 0,b1 put 66 into variable b1read 5,b2 puts “V” into variable b2

Page 5: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 5

The Normal way to use EEPROM (Write 16 lines by 16 Bytes)

EEPROM $00,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

EEPROM $10,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $20,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $30,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $40,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $50,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $60,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $70,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $80,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $90,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $A0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $B0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $C0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $D0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $E0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $F0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

; In the above, all the data is zero; the location is written in Hex; Note that $10 corresponds to decimal 16 … 16 numbers per line!

Page 6: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 6

EEPROM Practice Files

► eeprom_simple_test.bas► eeprom_simple_test1.bas

Page 7: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 7

EEPROM with Keyboard

Example: the scan code for the Key “A” is $1C

main:Kbin [1000,main], b1 ;get scan code. Put into variable b1read b1,b2 ;read from the EEPROMdebuggoto main; All data set to zero except the “A” at location $1C

EEPROM $00,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

EEPROM $10,(0,0,0,0,0,0,0,0,0,0,0,0,”A”,0,0,0)EEPROM $20,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $30,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $40,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $50,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $60,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $70,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $80,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $90,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $A0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $B0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $C0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $D0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $E0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)EEPROM $F0,(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)

Page 8: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 8

Keyboard & EEPROM Practice Files

► keyboardscancode.bas► keyineepromtable.bas

Page 9: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 9

Power Meter

Elecraft DL1 minimodule 20 Watt Dummy Load/Power MeterElecraft

VE3KL 16 Watt Dummy Load/Power Meter

Page 10: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 10

Power Meter Block Diagram

TransmitterCW 10 Watts

DummyLoadDetector

Picaxe

AnalogInput

EEPROM

0 to 5 Volts DC

I2C DisplayDiode Detector . Detects RF from TXDC fed to ADC of Picaxe (0 to 255)Picaxe looks up power level from EEPROMPower out displayed in Watts

EEPROM values calculated from a formula

David
Page 11: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 11

Power Meter Circuit10 Watts Max

RPicaxe

AnalogInput(Pin 19)

EEPROM

I2C DisplayR CRF Input

R=25 Ohms C=0.01 uF D1: 1N5711 D2: 1N914 R1 20K R2 10 K

R2

R1

+5 VoltsD1

D2

David
Page 12: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 12

The Formula

Pin = (10/255^2)*bo^2

bo is the A/D variable read in to the PicaxeThis formula is written into the EEPROMSee the program supplied

David
Page 13: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

04/18/23 David Conn VE3KL 13

Program Flow

PowerMeter_template.bas

; program flow; set up i2c slave for display; adc into b0; read power from EEPROM; use bintoascii to separate the power numbers; write to the display; loop

David
Page 14: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

Power Meter Calibration

• Adjust R2 to give proper reading compared to a power meter standard

• Do this for several frequencies up to 500 MHz

• Put correction factor in program

• Use simple keypad to select the band of operation.

Page 15: 11/29/2015David Conn VE3KL1 OARC Microcontroller Club Project 2009 Picaxe PIC16F886.

73 Dave VE3KL

• Work lots of DX

• Build stuff

• Attend flea markets and hope for a following wind