thank you mischl!
But the hserout command "Send one or more Items to the hardware serial port" and the 12f675 hasn't one!
I used this SerOut2 PORTB.3,12,[$B0,0,control] with a 16f84a and it's ok,but with 12f675 it doesn't work!
Any idea?
thank you mischl!
But the hserout command "Send one or more Items to the hardware serial port" and the 12f675 hasn't one!
I used this SerOut2 PORTB.3,12,[$B0,0,control] with a 16f84a and it's ok,but with 12f675 it doesn't work!
Any idea?
GPIO.3 is INPUT ONLY. Use a different pin and please read the datasheet. You probably need to disable AD and comparator aswell.
I used gpio.2 as output to send midi messages and i must use the gpio.0 and gpio.1 as ad inputs with pots!
I'm a beginner in pic programming,so please explain me how to configure these pins!
Thanks a lot
uuups. sorry, you are right, there is no uart at the 12f675 ;-)
look at the manual under SEROUT2 for calculating baud rate. 31250 baud needs a 20 mhz crystal.
for analog in : some sample program with a 12F675 look at TESTX4.BAS
i know it's only microcontrolling, but i like it!
I tried to use an external 20 mhz xtal with the serout2 but nothing!
Then i used the debug command with the internal xtal and finally some message appears but wrong,probably it can't reach 31250 baud! how can i disable the internal and use the external xtal?
please post your code si we can take a look
you can define the osc as usual, don't write any : @ DEVICE pic12F675, INTRC_OSC ' activates internal osc
how looks your serout2 command?
i know it's only microcontrolling, but i like it!
You set the use of an exernal oscillator in your programmer software, in your case you should look for HS oscillator. To make GP0 and 1 analog inputs, GP2 digital output and ADconverter 10bit, you should probably(never used the 12F675) use ....
TRISIO = %00000011
ANSEL = %00110011
ADCON0 = %10000001
ADvalue VAR WORD
ADCIN 0,ADvalue ' Read channel 0
ADCIN 1,ADvalue ' Read channel 1
I want to use gp0 and gp1 as analog inputs and gp3 as digital out to send midi messages:
DEFINE OSC 20
DEFINE DEBUG_BAUD 31250 ' midi baud rate
DEFINE DEBUG_REG gpio ' Set Debug pin port
DEFINE DEBUG_BIT 2 ' Set Debug pin bit
DEFINE DEBUG_MODE 0
adval var byte ' Create adval to store result
ANSEL = %00000011 ' ----DDAA
CMCON = 7 ' Analog comparators off
loop: ADCIN 0, adval ' Read channel 0 to adval
debug $b0,$00,adval
Pause 250 ' Do it all about 10 times a second
Goto loop ' Do it forever
End
how can i limit the results of analog inputs between 0-127?
Thanks a lot
Bookmarks