Simple Circuit

For E-blocks user to discuss using E-blocks and programming for them.

Moderators: Benj, Mods

Post Reply
EddieB
Posts: 55
Joined: Tue Jan 30, 2007 7:17 pm
Contact:

Simple Circuit

Post by EddieB »

Hello, I got my development board today and flowcode3.

I previously had a "bread block prototype board" eblock, that is connected to port a and b.I have connected the power supply from the development board to the prototype board. How could I go about making a simple circuit on this prototype board? I just want to be able to "turn a light" on and off.

Edit: Sorry, this is supposed to be in the e-block forum.

Cheers

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Post by Benj »

Hello Eddie

All you need to do is choose an output pin that will control the light and then connect the following circuit to that pin.

uC pin -- LED -- 220 Ohm Resistor -- GND

This will drive the LCD using the microcontroller pin.

To drive a light eg a small bulb you will need to boost the current using a transistor so the circuitry would be like this.

uC pin -- 1k resistor -- Base pin of Transistor
+5V -- Emittor pin of Transistor
Collector pin of Transistor -- Bulb -- small value Resistor -- GND

EddieB
Posts: 55
Joined: Tue Jan 30, 2007 7:17 pm
Contact:

Post by EddieB »

Hey there,

Ah, I didn't know you could use the data pins :P.

Ive just found out that I need a 13.5v dropper' to program this properly, at the moment, its not writing to the chip....

It seems to "crash" at the Erasing the PICmicro bit.

Cheers

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Hello world with Flowcode

Post by Mark »

Eddie,

Ports A and B bring out their 8 port pins and ground to the breadboard. I assume you will be using a LED as your light source, as these are low voltage (about 1.5v) and low current (PIC ports can nominally source 25mA but voltage drops long before this).

So simply connect one pin of the LED to ground and another (the leg with the thin bit in the casing) to a port pin. All ports are protected by 220ohm resistors so there should be no problem unless you have a high brightness type etc..

Now use flowcode, in a loop to : turn on the port pins, delay about 200ms or more, then turn off the port pins and delay again. Simulate the code to show that it works on screen. If it then does not work on the harware then check and recheck your configuration code settings.

I would avoid port A to start with as it has various idosyncracies, such as no pull up on RA4 and only 5 outputs on most chips.

Also I suggest downloading and reading the Microchip data sheet on your device of choice, it should make most things much clearer.

http://www.microchip.com/stellent/idcplg IdcService=SS_GET_PAGE&nodeId=74

This should give you your 'Hello world' example, good luck.

This post crossed with the ones above, but its here anyway.
Go with the Flow.

EddieB
Posts: 55
Joined: Tue Jan 30, 2007 7:17 pm
Contact:

Post by EddieB »

Hello Mark,

Ill try constructing this simple circuit and report back. But I think im going to need to find a 13.v5 power supply so that I can put my board into low voltage mode. I would have thought it come in low voltage mode.... Again, its not letting me clear the chip and write to it at the moment....

Cheers

EddieB
Posts: 55
Joined: Tue Jan 30, 2007 7:17 pm
Contact:

Post by EddieB »

Here is part of the build log:


Building CASM file

Memory Usage Report
===================
RAM available:368 bytes, used:2 bytes (0.6%), free:366 bytes (99.4%),
Heap size:366 bytes, Heap max single alloc:111 bytes
ROM available:4096 words, used:68 words (1.7%), free:4028 words (98.3%)


Successful

Return code = 0

Launching the programmer...

Sending program...
Erasing the PICmicro

....

Writing program memory
Writing configuration memory
Programming failed: <config1> & <config2>
That took 3.296 seconds

Return code = 0

FINISHED

User avatar
Steve
Matrix Staff
Posts: 3421
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

The 16F88 chips in the boards we ship should already be in LVP mode. The program in there should be a "knight-rider" effect (perhaps that should be a "cylon (bsg)" effect for those less than 30!). This should miss out the RB3 LED (because this is the LVP pin and can't be used as an i/o pin).

You may need to put the jumpers in the appropriate settings for LVP programming without a power supply - i.e. J29 = USB; J12-4 = USB, J11 = LVP.

EddieB
Posts: 55
Joined: Tue Jan 30, 2007 7:17 pm
Contact:

Post by EddieB »

Hey Steve,

I have the USB jumpers set, but im not sure about the other jumpers at the bottom of my board. Is there a pdf or info sheet on these jumpers? Im a bit in the dark here...

Cheers

User avatar
Steve
Matrix Staff
Posts: 3421
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Post by Steve »

for LVP programming, the appropriate LVP pin must be set by these 3 jumpers. For the 16F88, RB3 is the LVP pin. So the "jumper selection bits" in the bottom right of the board should be as follows:

RB3 = right (LVP PROG)
RB4 = left (I/O PORT)
RB5 = left (I/O PORT)

This should be detailed in the PDF for the EB006 eblock.

EddieB
Posts: 55
Joined: Tue Jan 30, 2007 7:17 pm
Contact:

Post by EddieB »

Hey,

I had the LVP jumpers wrong.... It all works now, although I cant stop my programmer....

Cheers

EddieB
Posts: 55
Joined: Tue Jan 30, 2007 7:17 pm
Contact:

Post by EddieB »

Im all sorted now guys :)

Thanks for all your help!

Cheers

Post Reply