I got the module working now, I will be doing some testing thursday.
by the way i wouls like to have a crystal oscillate by itself, How do i do that ? I have a sensor chip that needs to be clocked. I tried connecting it to + and ground but nothing
I got the module working now, I will be doing some testing thursday.
by the way i wouls like to have a crystal oscillate by itself, How do i do that ? I have a sensor chip that needs to be clocked. I tried connecting it to + and ground but nothing
Crystals don't oscillator by themselves. In short, you have to have a small inverting amp, induce a phase shift, and a few other things to get a usable signal from them. Grab the datasheet for a 4066 and see what they do with a crystal and one of those chips. Or just buy a DIP oscillator of the frequency of your choice (Digikey ECS oscillators).
I got the oscillator goimg, Its square wave, I will be adding a couple of caps and resisor to make it more like a sin wave.
Also I needed more memory for my project so I got the monster Pic18F4685. Iuse the same program as for the Pic16F877a and it gives errors about the nbit number, I guess I have to change all the specification of my program. but I am not sure what; here is the message i am getting after compiling:
C:\PBP>pbp -p18F4685 motorG
PICBASIC PRO(TM) Compiler 2.47, (c) 1998, 2006 microEngineering Labs, Inc.
All Rights Reserved.
PM Assembler 4.08, Copyright (c) 1995, 2006 microEngineering Labs, Inc.
Error 18F4685.INC 14 : [235] Opcode Expected Instead of 'Error: PM does not sup
port this device. Use MPASM.'
Error C:\PBP\MOTORG.ASM 85 : [225] Undefined Symbol 'PORTB'
Error C:\PBP\MOTORG.ASM 86 : [225] Undefined Symbol 'PORTC'
Error C:\PBP\MOTORG.ASM 87 : [225] Undefined Symbol 'TRISB'
Error C:\PBP\MOTORG.ASM 88 : [225] Undefined Symbol 'TRISC'
Error PBPPIC18.LIB 161 : [225] Undefined Symbol 'PORTB'
Error PBPPIC18.LIB 379 : [225] Undefined Symbol 'PORTB'
Error PBPPIC18.LIB 1153 : [200] Instruction Restricted to 14-Bit Core
Error PBPPIC18.LIB 1153 : [218] Address Limit of FFFFh Exceeded
Error PBPPIC18.LIB 1158 : [200] Instruction Restricted to 14-Bit Core
Error PBPPIC18.LIB 1158 : [218] Address Limit of FFFFh Exceeded
Error PBPPIC18.LIB 1281 : [200] Instruction Restricted to 14-Bit Core
Error PBPPIC18.LIB 1281 : [218] Address Limit of FFFFh Exceeded
Error PBPPIC18.LIB 1282 : [200] Instruction Restricted to 14-Bit Core
Error PBPPIC18.LIB 1282 : [218] Address Limit of FFFFh Exceeded
Fatal PBPPIC18.LIB 1282 : [300] Too Many Errors
C:\PBP>
O ok, because i saw the .BAS and .INC files, so I thougt it would take it.
alright
HI,
I am almost finish writing my code and I get an error at the receivring end, I have an LCDout and the sending end, it good number, but at the receiving end the information is confused.
meaning the Left is showing the same thing as the sending left.
But the right is showing me number like 12421 (pot at center). I encode and decode he same way, This is weird. what also struck me is that number 12421 is constant, so that when I move my pot there is a variation from 12542 to 12288 .
I also flipped the serin line for left and right and i get the same result..
(the sending and show number varying between 0 to 255)
here is a snippet of the code:
right var word : left var word : temp var word : counter var byte
rightold var word : leftold var word : speedright var word : speedleft var word
loop:
waitfor55:
serin portb.2 , n2400 , temp
if temp <> $55 then goto waitfor55
waitforaa:
serin portb.2 , n2400 , temp : if temp <> $aa then goto waitforaa
serin portb.2, n2400, rightold.LowBYTE : serin portb.2, n2400, rightold.HighBYTE
serin portb.2, n2400, leftold.LowBYTE : serin portb.2, n2400, leftold.HighBYTE
For counter=0 TO 7 'decoding
left.0[counter]=leftold.0[counter*2]
right.0[counter]=rightold.0[counter*2]
Next counter
Lcdout $fe, 1 'Clear screen
Lcdout "Left: ", Dec left
Lcdout $fe, $C0, "Right: ", DEC right
Pause 100
before you ask, here is my sending part:
send:
Lcdout $fe, 1 'Clear screen
Lcdout "Left: ", Dec left
Lcdout $fe, $C0, "Right: ", DEC right
serout portb.2, n2400,[$55,$55,$55,$55,$55,$55,$55,$55,$aa]
serout portb.2, n2400,[rightnew.LowBYTE,rightnew.HighBYTE]
serout portb.2, n2400,[leftnew.LowBYTE,leftnew.HighBYTE]
goto loop
end
Last edited by lerameur; - 11th January 2007 at 17:54.
Bookmarks