PDA

View Full Version : dumb question



osceola
- 16th August 2009, 12:19
Hi guys,
Im working on a project and have a very dumb question:
Can a eeprom be programed to store data from an F2F decoder?So in the schematic will be only F2F decoder and eeprom?And data will be downloaded from there in a second time using another software?

Melanie
- 16th August 2009, 13:00
An EEPROM has no intelligence - it cannot act on it's own.

An F2F Decoder has no intelligence - it cannot act on it's own.

Yes, an EEPROM can store the Data from your F2F Decoder, but you need some controlling intelligence to accomplish the task. So you need (typically) a microprocessor (eg a PIC) somewhere in the equation.

osceola
- 16th August 2009, 17:49
Thank you Melanie for your answer,very kind of you.Another question then,can you program an eeprom to do that and exclude the pic from ecuation or not?

mackrackit
- 16th August 2009, 18:00
Like Melanie said.
An EEPROM can not act on it's own. You need something to give it instructions. It is just a storage device. Like a hard drive. Alone it is not much good.

osceola
- 16th August 2009, 18:20
ok,thank you,got it now.witch will be the best 512kb EEPROM to use?24C512 or 24LC512?whats the diference between these 2?and also witch will be the 8pin based best PIC to use?12F675 or 12F683?Or you recomend something else?Thank you

Melanie
- 16th August 2009, 19:28
You must chose a PIC with enough pins for your F2F devices, two pins for the EEPROM (C or LC still require two lines regardless which one you chose), and however many additional pins for external communications or other connections. Remember one of the pins on the 12F675/683 is INPUT ONLY that leaves five I/O's. If you are going to use Serial Communications (like RS232) then you WILL need a Crystal or Resonator, that will use up two pins, and three I/O's may then be insufficient for your needs.

As regarding EEPROMS... the 'C' device is a plain SERIAL device requiring something like SHIFTIN/SHIFTOUT usage, whereas the 'LC' is an I2C BUS device requiring I2CWRITE/I2CREAD usage.

osceola
- 16th August 2009, 21:11
Thank you Melanie for your answer I got it now.Where can I find a schematic or something to test that,or who could give me an advice on how to built this?

osceola
- 17th August 2009, 11:11
No one wants to help me?

mackrackit
- 17th August 2009, 11:29
Which way do you want to go?

If you go with the I2C method then take a look at the PBP manual. There is enough information there to get you started.

The section in the manual about shiftin/out along with a data sheet will also get you started in that direction.

Let us know the parts you plan on using.

osceola
- 17th August 2009, 12:18
Well,first I need a schematic,and I also would like to know if the F2F decoding can be done inside a PIC(16f628, 16f84 etc.) to make it as simply is posibile.So,can the F2F decoding be done inside a pic and witch series of EEPROM to use for that,24C512 or 24LC512?

osceola
- 17th August 2009, 21:35
Could anyone provide me a schematic of this or help me find it?

mackrackit
- 18th August 2009, 10:46
Have you read the data sheet for the F2F part you plan to use?

osceola
- 18th August 2009, 13:07
Not yet,Im looking around to see if is on the market a PIC with F2F built in,soon as I decide I contact you

osceola
- 18th August 2009, 14:29
Have you read the data sheet for the F2F part you plan to use?

yes ,I have read the data sheet and have some schematic too,just that comes with an lcd and need to make it moore simple,keep the existing components and remove the lcd components.any help?I will PM you the schematic.thank you

mackrackit
- 18th August 2009, 14:45
Post everything on the forum. That way anyone can help or benifit.

osceola
- 18th August 2009, 14:51
I have find this schematic for read magnetic data for the magnetic heads witch have built in F2F decoder,just need to make it moore simple,without LCD display: http://www.camelspit.org/handyswipe/ Could anyone help?My electronic knowledge is bad,any help would be apreciate.Thanks

Melanie
- 18th August 2009, 18:26
http://www.melabs.com/resources/samples/submitted/MagCard.txt

osceola
- 18th August 2009, 18:53
Thank you Melanie,is any schematic on this link with eeprom memory and serial interface or could somebody help me to design a schematic?

mackrackit
- 18th August 2009, 23:52
The data sheet for the eeprom you plan to use should have a schematic showing how it is to be connected.

Have you picked an eeprom yet?

osceola
- 19th August 2009, 00:01
No,I havet picked an EEPROM yet because I dont know witch one to order-C or LC series,witch is best or witch one you think may be good for serial comunication?And there at the source code that Melanie posted,is any diference betveen PIC16F628-04/SO , PIC16F628-04/SP or PIC16F628-04I/S?Dont find the PIC16F628-04/SP and dont know witch one to order.

mackrackit
- 19th August 2009, 00:13
Melanie already answered this...


As regarding EEPROMS... the 'C' device is a plain SERIAL device requiring something like SHIFTIN/SHIFTOUT usage, whereas the 'LC' is an I2C BUS device requiring I2CWRITE/I2CREAD usage.

Look at the last few pages of the PIC's data sheet. The info you seek is there :)
a differance in package, some like surface, some like dips.

osceola
- 19th August 2009, 00:28
So can I order any of these PICs mentioned?And I will look what EEPROM I can find.Interfacing PIC with EEPROM and in the schematic need also some resistors and capacitors?witch one and how many?Thanks

Melanie
- 19th August 2009, 00:30
EEPROM Schematic Information and example code is contained in your MeLabs PBP Manual that came with your PICBasic compiler.

mackrackit
- 19th August 2009, 00:46
Just curious...
Is this your first project?

osceola
- 19th August 2009, 00:48
I ordered the Pic Kit 2 already,have to get it this days,and yes,this is my first project and any help from you will be apreciated,so sory if sometime(or always?) I make some dumb questions

mackrackit
- 19th August 2009, 01:11
Do not worry about the questions. Everyone has to get started.
Now do not take this the wrong way, but this project might be a little advanced for a first project. Like anything else, you need to work your way up.

When you order the PIC make sure it is a DIP package. That way it can be plugged into a breadboard. The same goes for the EEPROM.

When the PICKIT comes let's work on a simple what we call "blinkey". That is a program that will simply blink a LED at a given rate. What this will do is make sure you understand how to set everything up. Then we can move on to more advanced things.

In the mean time. Read everything you can on this forum. Study the data sheets for the parts you plan to use.

In no time this project will be up and running and you will understand what is going on.

osceola
- 19th August 2009, 11:34
Ok,thank you,I will do that

osceola
- 22nd August 2009, 11:20
Hi,I got yhe PICKIT2 package,where I start from?I buy 2 PIC16F628 but when I read them says ALL PROTECT ,I erase them and when I verify says Program Memory is not blank starting at address 0x0000.Am I doing something wrong?

mackrackit
- 22nd August 2009, 13:32
In the PicKit2 software under "tools" there is a enable code protect option. Un-check that. Or if you have code protect in the configs turn it off there.

With the code protect off, an erase and blank check should return "Device is Blank".

osceola
- 22nd August 2009, 14:16
Well,I did exactly as you say but still same results.What else should I do?Strange,because I have this problem with PIC16F628 only,the PIC16F690 witch come with the PICKIT2 read it as a blank device.Same thing with the EEPROM too.I read it ,erase it and at blank check says EEPROM is not blank starting at address 0x000000

osceola
- 22nd August 2009, 16:50
Ok,I figure it out at the end,what we start with?

mackrackit
- 22nd August 2009, 19:14
A couple of questions to make sure we are both looking at the same things.

What are you going to be using for the OSC?
Is the chip a 628 or 628A?
You have Micro Code Studio installed?
Some LEDs and 220 or 470 or something in that range resitors?

osceola
- 22nd August 2009, 19:21
Well,at this point we have to wait a few days,just ordered a breadboard witch has to come,some LEDs I have,Micro I have,rezistors I dont have yet.The chip is 628.Another "dumb" question--at witch pins you put the EEPROM into the PICKIT2 programer to read data from it?Another thing,I am using Vista and linux,but I installed the PICKIT2 package in Vista--will it work?Thanks

mackrackit
- 22nd August 2009, 20:02
What!?! No resistors? That is like coming to class with out a pencil. :)

Vista is ok.

Do you mean the EEPROM that is built into the PIC. Use the same connection as you have when programmng

mackrackit
- 22nd August 2009, 20:10
Did you get a demo board with the PicKit? The one with LEDs and buttons and ...
If you did you can start playing now. The 628 can happen later.

osceola
- 22nd August 2009, 20:58
I have the board,then,Im ready to play!

osceola
- 22nd August 2009, 22:02
What!?! No resistors? That is like coming to class with out a pencil. :)

Vista is ok.

Do you mean the EEPROM that is built into the PIC. Use the same connection as you have when programmng
No,not the EEPROM that is built into the PIC,a normal EEPROM,24LC512,and I havent find any datasheets to look at how you have to connect the EEPROM to the PICKIT2 board

mackrackit
- 22nd August 2009, 22:56
Lets worry about the eeprom a bit later.

I want you to read this
http://www.picbasic.co.uk/forum/showthread.php?t=543
We will be setting the fuses in your code, in the long run this seems to be the best way. Later when you go back to a program you will not have to remember how you had them set.

Now I am going to assume you have the low pin count board with the 16F690 on it?

osceola
- 22nd August 2009, 23:13
Yes,PIC16F690.Im reading.....

osceola
- 23rd August 2009, 00:17
http://www.picbasic.co.uk/forum/showthread.php?t=543
So basicly if Im using MPLAB IDE and MPASM as assembler this tools will be located in the MPLAB IDE folder under the aplication Maestro?

mackrackit
- 23rd August 2009, 00:24
For now use Micro Code Studio and MPASAM as the assembler. I am hearing about problems with MPLAB right now.
The file you need to comment the lines in is in the PBP directory.

Assuming you have the 16F690.inc file commented on the correct lines like the above thread shows... This code should have a couple LEDs blinking.



'16F690 DEMO
' DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
' OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000

'The first line is if you are using PM, the second if you are using MPASAM
' @ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF

'VARS
LED1 VAR PORTC.0
LED2 VAR PORTC.1

START:
HIGH LED1
LOW LED2
PAUSE 250
LOW LED1
HIGH LED2
PAUSE 250
GOTO START

This should do the same as the above code but in a different way.


'16F690 DEMO_2
' DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
' OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000

'The first line is if you are using PM, the second if you are using MPASAM
' @ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF

TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs

START:
PORTC = %00000001
PAUSE 250
PORTC = %00000010
GOTO START

I do not have the demo board that you have, so I hope I did not make a mistake.
Play with these and look in the manual to see how to add a button for an input.
Then change things so when the button is pressed the LEDs blink differently.

osceola
- 23rd August 2009, 00:42
Ok,I think we miss a lesson first of this:how to use Micro Code Studio,how compiling a file and how convert it to hex files and after load it to chip :o

osceola
- 23rd August 2009, 00:54
I compile that code with Micro Code Studio and
at the first cod only blink Led no2 on the board without pressing nothing
at the second code stay On Led no1 without pressing nothing
and in the compiler I got this error when compiling
Error LED2.ASM 49 : [235] opcode expected instead of '_config
Im using Micro Code Studio with PICBASIC PRO Compiler Demo

mackrackit
- 23rd August 2009, 01:15
In MCS on the toolbar click View then go to Compiler and program options. Then go to the Assembler tab. You pick MPASAM there. If the box is unchecked then PM is used.

osceola
- 23rd August 2009, 01:27
Ok done that,have you read my previsious post before posting?I did compile it with PM,got some errors in it but at the end got some results

mackrackit
- 23rd August 2009, 01:44
Using PM.
Did you change the code to work with PM. The way I have it posted it is for MPASM.
Maybe I confused things the way I did it. I was wanting to show both ways.

osceola
- 23rd August 2009, 03:14
Yes,I change code,but would be easy for start with using just 1 tipe of code.Thank you

osceola
- 23rd August 2009, 14:52
Whats next ?

mackrackit
- 23rd August 2009, 15:34
Whats next ?

So you got the LEDs blinking? Did you get a button working to change the way the LEDs blink?

Post your code so we can take a look.

osceola
- 23rd August 2009, 16:08
I have compiled and anssemblex and importing hex file in pickit2 and write to PIC.with this code only the second Led from the board is blinking and when press buttonthe Led is not blink.
[code]
'16F690 DEMO
' DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
' OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000


' @ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off

'VARS
LED1 VAR PORTC.0
LED2 VAR PORTC.1

START:
HIGH LED1
LOW LED2
PAUSE 250
LOW LED1
HIGH LED2
PAUSE 250
GOTO START
[code]

The 2 code dont work
[code]
'16F690 DEMO_2
' DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
' OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000

'The first line is if you are using PM, the second if you are using MPASAM
' @ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off


TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs

START:
PORTC = %00000001
PAUSE 250
PORTC = %00000010
GOTO START
[code]
I get this errors:
Error LED2.ASM 45 : [225] undefined symbol 'osccon'
---------------46-------------------------'trisc'
---------------49-------------------------'portc'
Fatal----------49 : [300] too many errors

mackrackit
- 23rd August 2009, 19:00
Did you comment the lines in the 16F690.inc file that is in the PBP directory? Like the config thread pointed out.

In MCS do you have the box checked to use MPASM?

osceola
- 23rd August 2009, 19:10
Did you comment the lines in the 16F690.inc file that is in the PBP directory? Like the config thread pointed out.

In MCS do you have the box checked to use MPASM?
In MCS box in unchecked,and where do I find the .inc file of PIC16F690?

:o

mackrackit
- 23rd August 2009, 20:06
The default install of Pic Basic Pro is in C:\PBP. That is where you will find all of the *.inc files for PBP.

osceola
- 23rd August 2009, 20:21
I cant do it because I have the demo version of PBP,is other way to do that?

mackrackit
- 23rd August 2009, 20:57
I have not had the demo version for a long time. I think the only thing you cannot do with the demo for the chips it supports is write code over a certain size.

The install directory might be named something else though, so you will have to look around.

osceola
- 23rd August 2009, 22:18
;************************************************* ***************
;* 16F690.INC *
;* *
;* Notice : Copyright (c) 2006 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 05/23/06 *
;* Version : Demo *
;* Notes : *
;************************************************* ***************
NOLIST

__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
NOLIST
endif
LIST
'16F690 DEMO_2
' DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
' OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000

@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF

TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs

START:
PORTC = %00000001
PAUSE 250
PORTC = %00000010
GOTO START

Results:
ERROR Line 12: Syntax error.(16F690.INC)
ERROR Line 13: Redefinition of LABEL NOLIST.(16F690.INC)
ERROR Line 14: ENDIF without a matching IF..THEN.(16F690.INC)

osceola
- 23rd August 2009, 22:36
Did it again.I opened from the open file-16F690.INC and paste your code plus another file where past your code


;************************************************* ***************
;* 16F690.INC *
;* *
;* Notice : Copyright (c) 2006 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 05/23/06 *
;* Version : Demo *
;* Notes : *
;************************************************* ***************
NOLIST

__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF
NOLIST
endif
LIST
'16F690 DEMO_2
' DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
' OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000

@ __config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLR_ON & _CPD_OFF

TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs

START:
PORTC = %00000001
PAUSE 250
PORTC = %00000010
GOTO START

First is 16F690.INC second is the code I paste it from you


'************************************************* ***************
'* Name : UNTITLED.BAS *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 23/08/2009 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
'16F690 DEMO_2
' DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
' OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000
__config _INTRC_OSC_NOCLKOUT & _WDT_ON & _MCLRE_ON & _CP_OFF

TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs

START:
PORTC = %00000001
PAUSE 250
PORTC = %00000010
GOTO START

Results:
ERROR Line 17 : Syntax error.(led.pbp)
I dont understand nothing,so hard is it to create a code?!?...or I am really dumb?

mackrackit
- 23rd August 2009, 23:32
You are not following the directions. Go back and read all of the links and post.

Why do you need the card reader in the first place? Seems like a lot of work.

osceola
- 23rd August 2009, 23:46
Maybe you are right that Im not folowing the corect line of instructions,but my english is not so good and were are many explanation I dont get it.Would be easy if somebody could tell me in little words what to folow,I know how stressfull can be when you explain to somebody something and dont get it and you have to explain again and again....Honestly I really dont know were to start from :confused:

osceola
- 24th August 2009, 00:22
Anyway...I want to learn and will do that again,thank you for helping me

mackrackit
- 24th August 2009, 00:47
Keep reading and trying. The LEDs will blink. But I would put the card reader on the back shelf for awhile.

osceola
- 24th August 2009, 21:42
Thanks for being patience,at the end I did it!But with this code one led stay on,and wit other code I will post one led is blinking.whats next?


'************************************************* ***************
'* Name : P16F690.INC *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 24/08/2009 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
'16F690 DEMO
'
DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000

@ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off

TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs

START:
PORTC = %00000001
PAUSE 250
PORTC = %00000010
GOTO START

osceola
- 24th August 2009, 22:14
With this code one led is blinking.By the way,I had no succes compiling with MPASM,I use PM for both.


'************************************************* ***************
'* Name : P16F690.INC *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 24/08/2009 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
'16F690 DEMO
DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000


@ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off


'VARS
LED1 VAR PORTC.0
LED2 VAR PORTC.1

START:
HIGH LED1
LOW LED2
PAUSE 250
LOW LED1
HIGH LED2
PAUSE 250
GOTO START

I have now a breadboard,rezistors,leds and PIC16F628.Can we go on with it?
THANK YOU!!!

mackrackit
- 24th August 2009, 22:20
Do you have MPASM installed? Does not really matter for this stuff but you will need it later.

Why only one LED? You should have two. And you were to work on a button part of the code to change the way the LEDs blink.

osceola
- 24th August 2009, 22:23
Do you have MPASM installed? Does not really matter for this stuff but you will need it later.

Why only one LED? You should have two. And you were to work on a button part of the code to change the way the LEDs blink.

Yes,I have it installed,I think,is the one with comes on cd with PICKIT 2? Is named MPASMWIN?If is this,yes,I have it installed.
Sorry but didnt get this:And you were to work on a button part of the code to change the way the LEDs blink.
To work where?Do I have to change something?

osceola
- 24th August 2009, 23:26
Ok,I did it now,I ansemble the two codes toghether and now are blinking both Leds.


'************************************************* ***************
'* Name : P16F690.INC *
'* Author : [select VIEW...EDITOR OPTIONS] *
'* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 25/08/2009 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
'16F690 DEMO
'
DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000

@ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off

TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs
'VARS
LED1 VAR PORTC.0
LED2 VAR PORTC.1
START:
HIGH LED1
LOW LED2
PAUSE 250
LOW LED1
HIGH LED2
PAUSE 250
PORTC = %00000001
PAUSE 250
PORTC = %00000010
GOTO START

With this code is blinking LED 1 and 2

osceola
- 24th August 2009, 23:30
With this code is blinking LED no.1 and 4.


'16F690 DEMO
'
DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000

@ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off

TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs
'VARS
LED1 VAR PORTC.2
LED2 VAR PORTC.3
START:
HIGH LED1
LOW LED2
PAUSE 250
LOW LED1
HIGH LED2
PAUSE 250
PORTC = %00000001
PAUSE 250
PORTC = %00000010
GOTO START

osceola
- 24th August 2009, 23:34
With this code is blinking LED no.1 and 3...and also change timer to 500



'16F690 DEMO
'
DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000

@ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off

TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs
'VARS
LED1 VAR PORTC.0
LED2 VAR PORTC.2
START:
HIGH LED1
LOW LED2
PAUSE 250
LOW LED1
HIGH LED2
PAUSE 500
PORTC = %00000001
PAUSE 500
PORTC = %00000010
GOTO START

osceola
- 24th August 2009, 23:41
..and here I change PORTC order , timer and Leds:


'16F690 DEMO
'
DEFINE OSC 8 'Comment the 4Mhz and uncomment these for 8Mhz
OSCCON=%01110000

DEFINE OSC 4 'This is the default setting
OSCCON=%01100000

@ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off

TRISC = %00000000 '0 will make the pins an output, 1 will make them inputs
'VARS
LED1 VAR PORTC.0
LED2 VAR PORTC.3
START:
HIGH LED1
LOW LED2
PAUSE 250
LOW LED1
HIGH LED2
PAUSE 1500
PORTC = %00000010
PAUSE 1500
PORTC = %00000001
GOTO START

mackrackit
- 25th August 2009, 09:42
Sorry but didnt get this:And you were to work on a button part of the code to change the way the LEDs blink.
To work where?Do I have to change something?
Now you have to write your own code so when you push the button on the demo board a different set of LEDs blink. The manual will be a help while doing this.

The code you have posted has two oscillator settings, you only want one.

osceola
- 25th August 2009, 11:14
Witch manual?And isnt the way I did it before right?

osceola
- 25th August 2009, 13:01
I create this code,after the model you send me,but just to understand,I would like to know where do I have to make changes -because now is blinking one LED and then 3 LED at time:


'************************************************* ***************
'* Name : P16F690.INC *
'* Author : [ Osceola ] *
'* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 25/08/2009 *
'* Version : 1.0 *
'* Notes : 16F690 DEMO *
'* : *
'************************************************* ***************
'16F690 DEMO
'
DEFINE OSC 4
OSCCON=%01100000

@ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
TRISC = %00101010 '0 will make the pins an output, 1 will make them inputs
'VARS
LED1 VAR PORTC.0
LED2 VAR PORTC.1
LED3 Var PORTC.2
LED4 VAR PORTC.3
START:
HIGH LED1
LOW LED2
HIGH LED3
LOW LED4
PAUSE 300
LOW LED1
HIGH LED2
LOW LED3
HIGH LED4
PAUSE 300
PORTC = %00000111
PAUSE 300
HIGH LED1
LOW LED2
HIGH LED3
LOW LED4
PAUSE 300
LOW LED1
HIGH LED2
LOW LED3
HIGH LED4
PORTC = %11100000
GOTO START

osceola
- 25th August 2009, 13:03
And here the LEDs blink in other way:


'************************************************* ***************
'* Name : P16F690.INC *
'* Author : [ Osceola ] *
'* Notice : Copyright (c) 2009 [select VIEW...EDITOR OPTIONS] *
'* : All Rights Reserved *
'* Date : 25/08/2009 *
'* Version : 1.0 *
'* Notes : 16F690 DEMO *
'* : *
'************************************************* ***************
'16F690 DEMO
'
DEFINE OSC 4
OSCCON=%01100000

@ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
TRISC = %00101010 '0 will make the pins an output, 1 will make them inputs
'VARS
LED1 VAR PORTC.0
LED2 VAR PORTC.1
LED3 Var PORTC.2
LED4 VAR PORTC.3
START:
HIGH LED1
LOW LED2
HIGH LED3
LOW LED4
PAUSE 300
LOW LED1
HIGH LED2
LOW LED3
HIGH LED4
PAUSE 300
PORTC = %00000111
PAUSE 300
HIGH LED1
LOW LED2
HIGH LED3
LOW LED4
PAUSE 300
LOW LED1
HIGH LED2
LOW LED3
HIGH LED4
PAUSE 300
PORTC = %11100000
PAUSE 300
GOTO START

mackrackit
- 25th August 2009, 14:01
What does this do?


PORTC = %11100000


The manual you can not find is linked on the page where you got your demo.

This page has samples that you need to work through and understand
http://www.melabs.com/resources/samples.htm#code

osceola
- 25th August 2009, 19:22
Thank you!

osceola
- 25th August 2009, 21:28
I have compiled this and dont know why only 3 LEDs are blinking and the 4th doesnt blink.Could you tell me where I am mistaken,to understand better.Thank you


'************************************************* ***************
'* Name : P16F690.INC *
'* Author : [osceola] *
'* Notice : *
'* : All Rights Reserved *
'* Date : 25/08/2009 *
'* Version : 1.0 *
'* Notes : *
'* : *
'************************************************* ***************
' PICBASIC PRO program to blink 3 LEDS in sequence

' Define LOADER_USED to allow use of the boot loader.
' This will not affect normal program operation.
Define LOADER_USED 1
DEFINE OSC 4 'This is the default setting
OSCCON=%01100000
@ device pic16F690, intrc_osc_noclkout, wdt_on, mclr_on, protect_off
i Var Byte ' Define loop variable
LED1 VAR PORTC.0
LED2 VAR PORTC.1
LED3 Var PORTC.2
LED4 VAR PORTC.3
LEDS Var PORTC

TRISC = %00000000 ' Set PORTC to all output

mainloop:
LEDs = 1
Pause 500
LEDS = 2
Pause 500
LEDS = 3
Pause 500 '
LEDS = 4
Pause 500 ' Delay for .5 seconds
For i = 1 To 4 ' Go through For..Next loop 2 times
LEDS = LEDS << 1 ' Shift on LED one to left
Pause 500 ' Delay for .5 seconds
Next i

Goto mainloop ' Go back to mainloop and blink LED forever

End

mackrackit
- 25th August 2009, 22:09
Decimal 4 equals what in Binary?

That brings us back to:
what does this do?


PORTC = %11100000

you have it in one of your codes.

osceola
- 25th August 2009, 23:03
Decimal 4 in Binary is 100.Sorry but dont understand,you said nothing about decimal to bynari conversions

mackrackit
- 26th August 2009, 02:53
Decimal 4 in Binary is 100.Sorry but dont understand,you said nothing about decimal to bynari conversions
You are correct on bothe accounts. It is 100 and I did not say anything about conversions. But you put LEDS = 4 in your code and I have asked you twice about a other line you wrote and you have not answered.

And you have not shown any attempts using the button on your demo board as an input.

You said you wanted to learn. Have you been studying the PICs data sheet and the Pic Basic manual? It looks to me like you have not.

So what do you really want? Do you want to learn or have someone write your code for you?

osceola
- 26th August 2009, 11:44
I dont want to be rude,sorry,but seems hard to me or I am really dumb and dont understand.I have a code witch I find on Microchip website,just want to modify it to write data to EEPROM-and for that I have to learn a lot,I have less then 2 weeks remain to present the project and Im going out of time...As you said,would be easy if somebody write the code,but I dont know who will do that,maybe somebody who wants to help me

mackrackit
- 26th August 2009, 12:43
So this is a project for school and you want someone to do the work for you?

That is not what we do here. Sorry.

osceola
- 26th August 2009, 12:48
yes is a project for school but not what you think.Thank you anyway

mackrackit
- 26th August 2009, 13:08
What am I to think? You just admitted you want some one to do your work. Where I come from that is called cheating. I have tried to help you learn.

Seems the first thing you need to learn is honesty.

osceola
- 26th August 2009, 13:19
You ask me if I want someone to write the code for me,I say yes,after you say that Im cheating...I dont understand nothing...anyway...they are a lots of other forums...and somwhere I will find someone who will help me......Regarding honestly...I was honest,I didnt come with some other stories to tell.Have a nice day,Im going cause Im waisting my time here

Acetronics2
- 26th August 2009, 13:37
Hi, Dave

The answer is quite evident ...



I cant do it because I have the demo version of PBP,is other way to do that?


sooooo, someone MUST do that for him ...

It's more than true that further exercises will make him loose his time : he won't be able to realize it !!!

Regards

Alain

osceola
- 26th August 2009, 14:03
Hi, Dave

The answer is quite evident ...



sooooo, someone MUST do that for him ...

It's more than true that further exercises will make him loose his time : he won't be able to realize it !!!

Regards

Alain
You have right,after moore then 30 or 31 line used the PBP dont compile the program.I say that because I try it.

osceola
- 26th August 2009, 15:19
If someone would be so kind to do this for me please PM me.Thank you

Acetronics2
- 26th August 2009, 15:26
Halas,

You have no other solution else than find a computer with a full PBP release ...

or change compiler you are working on !!! ( note I do not know any demo version generous enough to allow such a completed project ... Microchip C compilers, may be.)


being realistic, you are the one and only one who can write the full project close to your teacher's requirements ...

I think it was the goal of this small exercise ... no ???

Alain

PS: Hope you have understood WHY matter to realize the project you gave us the link to was not freely given ... ( the comments under the project ...)

osceola
- 26th August 2009, 15:32
Halas,

You have no other solution else than find a computer with a full PBP release ...

or change compiler you are working on !!! ( note I do not know any demo version generous enough to allow such a completed project ... Microchip C compilers, may be.)


being realistic, you are the one and only one who can write the full project close to your teacher's requirements ...

I think it was the goal of this small exercise ... no ???

Alain

Yes,you right,but instead of spending a lot of money on the sofware witch I use once,I prefer pay half money to somebody able to do that for me.I have the code,datasheets and everithing,just the schematic is without EEPROM,only RS232,only need someone to interface the PIC with EEPROM.

Acetronics2
- 26th August 2009, 15:51
but instead of spending a lot of money on the sofware witch I use once,
.

IF you were a real student ... You wouldn't use it only once ... that's sure.

... no further comment.

Alain

osceola
- 26th August 2009, 17:09
IF you were a real student ... You wouldn't use it only once ... that's sure.

... no further comment.

Alain

I cant affort to spend so much as software costs

mackrackit
- 26th August 2009, 17:22
And you can not afford the time to study and learn.
The future of engineering. YIKES!

osceola
- 26th August 2009, 17:51
It wasnt about the time to study and learn,I cant compile that with PBP demo version....anyway...Im loosing time here,this subject is going off topic

Acetronics2
- 26th August 2009, 18:39
Hey,

No luck with PicAxe forum nor ...

Did you try the microchip forum as advised there ???

Alain