Thanks again i will check the links and do what I can. as far as the code goes all of the code i have is written above.
Thanks again i will check the links and do what I can. as far as the code goes all of the code i have is written above.
Lets back up a bit. We normally start with a blinky program. If you have already done this then great, if not....
The configs will need set for the hardware. This can be done int the *.inc file found in the PBP directory or in code space. This link tell about it.
http://www.picbasic.co.uk/forum/showthread.php?t=543
Being that you are starting, start using MPASM for the assembler. It will save you trouble later.
Start with the 16F877A.
By default the OSC in the *.inc is set for XT. This is fine if you have a crystal attached, if you have a resonator change it to HS.
Now for the code,
The above will help you determine if the chip is running correctly.Code:'16F877A DEFINE OSC 4 ' This tells PBP how fast the chip is running. 'This line is the configs MPASAM style 'Comment it out if the configs are set in the *.inc @ __config _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF &_BODEN_OFF ADCON1=%00000111 ' Turns off the ADC CMCON=%00000111 'Turns off the Comparators TRISA = %00000000 ' Makes all pins on PORTA outputs 'Set up some variables. LED VAR PORTA.1 'Attach a LED to PORTA pin 1 RUN: Make the LED blink at 1 sec on and 1 sec off HIGH LED PAUSE 1000 LOW LED PAUSE 1000 GOTO RUN END
Do the same for the 12F683.
The PBP default is internal OSC and the chip defaults to 4 MHz. So you should be good as long as PBP is told about it.
DEFINE OSC 4
In you code like we did for the 877A.
Get everything blinking as it should and then tackle the serial part.
Last edited by mackrackit; - 8th December 2010 at 06:31.
Dave
Always wear safety glasses while programming.
Your flowpin is on GPIO.3.
SERIN2 GPIO.1\GPIO.3, 3313, [DEC X]
Put the serial data on GPIO.3, and the flowpin on GPIO.1.
flowpin needs to be able to output.
And set GPIO.0 to OUTPUT for the LED.
OUTPUT GPIO.0
Don't forget to disable MCLR in the configuration.
DT
I have been working on the code for a couple of days. I have made a small progression if i manually send a "1" to the SERIN it will assume a flash rate of 1. this is done by placing the datapin wire to ground. Hear is the current code i am working with. Any help would be great, Thanks!
Thanks again!Code:Recive: Clear define ocs 4 INCLUDE "modedefs.bas" @_config_HS_osc &_WDT_OFF &_LVP_OFF &_CP_OFF &_BODEN_OFF ADCON1 = %00000111 CMCON = %00000111 TRISA = %11111111 TRISD = %00000000 X VAR BYTE SERIN2 PORTA.5\PORTA.1, 3313, [DEC X] LOOP1: HIGH PORTD.2 PAUSE X LOW PORTD.2 PAUSE X GOTO LOOP1 END Send: Clear define ocs 4 INCLUDE "modedefs.bas" @_config_HS_osc &_WDT_OFF &_LVP_OFF &_CP_OFF &_BODEN_OFF ADCON1 = %00000111 CMCON = %00000111 TRISA = %00000000 TRISD = %00000000 PORTA = %00000000 LED VAR PORTA.1 X VAR BYTE X = 100 LOOP1: SEROUT2 PORTA.5/PORTA.1, 3313, [100] PAUSE 5000 GOTO LOOP1 END
Last edited by ScaleRobotics; - 12th December 2010 at 21:02. Reason: added code tags
Hi MangoKid,
I am away from MY Computer and my books, but if I understand this last statement correctly,
" this is done by placing the datapin wire to ground."
I believe you are referring to the ports "Idle State" if so here is the little secret: If you are sending TRUE the port wants a pull up resistor and if you are sending INVERTED the port wants a pull Down resistor.
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Not sure what you mean by datapin...
But..
On the receive side you are only checking the serial port once,
Put the SERIN2 line inside of LOOP1.Code:SERIN2 PORTA.5\PORTA.1, 3313, [DEC X] LOOP1: HIGH PORTD.2 PAUSE X LOW PORTD.2 PAUSE X GOTO LOOP1
Dave
Always wear safety glasses while programming.
Thats prolly my fault. Way back at the beginning I suggested to take it out of the loop. I was thinking it would be gotten before entering the loop.
-Bert
The glass is not half full or half empty, Its twice as big as needed for the job!
http://foamcasualty.com/ - Warbird R/C scratch building with foam!
Bookmarks