on the 16f916 the portc.0,c.1,c.2 are not working for me as an input and outputs respectively.
#chip 16F916, 4 'mhz
#config OSC=INTOSC, MCLRE=off, WDT=off
dir portc.1 out ' red
dir portc.2 out ' grn
dir portc.3 out ' red
dir portc.4 out ' grn
start:
set portc.1 on ' red
set portc.3 on ' red
set portc.2 on ' grn
set portc.4 on ' grn
goto start
the c.3 and c.4 work but c.1 and c.2 do not they stay low?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Looking at the 16F916 datasheet, C.0, C.1 and C.2 are used to control the LCD. If you look at section 3.5 of the datasheet, it shows a block diagram of what else is connected to the pin on the chip, and an assembly code example of how to set up the pin.
In Figure 3-16, there is a diagram of PORTC.1. Note the switch shown connecting the pin to "VLCD2", when LCDEN and LMUX<1:0> ≠ 00).
If you add this command to the start of your program:
LCDCON = 0
It will clear the bits that control the VLCD2 connection. Then the LCD module will be disabled, and you should have full access to the ports.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Come On! Just read datasheets and know your chip! GCBASIC isn't same as QBasic. You must have more knowledge than just simply take idea and code it in basic dialect. Why people don't learn ASM for controllers?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Reading the datasheet isn't something that I've suggested anywhere in the documentation, probably should fix that! Not reading the datasheet is a pretty common mistake for beginners, it's something that someone who isn't from an electronic background probably wouldn't have any idea to do.
People don't learn assembly straight away because it's harder to use. I think it's better for people to use a high level language at first, and gradually become familiar with working with microcontrollers. Once they know more about the microcontroller and general programming principles, then they can learn assembly if they need to do something that can't be done in an HLL. Of course, I don't think there are any compiler authors out there who'd recommend assembly!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
on the 16f916 the portc.0,c.1,c.2 are not working for me as an input and outputs respectively.
#chip 16F916, 4 'mhz
#config OSC=INTOSC, MCLRE=off, WDT=off
dir portc.1 out ' red
dir portc.2 out ' grn
dir portc.3 out ' red
dir portc.4 out ' grn
start:
set portc.1 on ' red
set portc.3 on ' red
set portc.2 on ' grn
set portc.4 on ' grn
goto start
the c.3 and c.4 work but c.1 and c.2 do not they stay low?
Looking at the 16F916 datasheet, C.0, C.1 and C.2 are used to control the LCD. If you look at section 3.5 of the datasheet, it shows a block diagram of what else is connected to the pin on the chip, and an assembly code example of how to set up the pin.
In Figure 3-16, there is a diagram of PORTC.1. Note the switch shown connecting the pin to "VLCD2", when LCDEN and LMUX<1:0> ≠ 00).
If you add this command to the start of your program:
LCDCON = 0
It will clear the bits that control the VLCD2 connection. Then the LCD module will be disabled, and you should have full access to the ports.
great thanks!
Come On! Just read datasheets and know your chip! GCBASIC isn't same as QBasic. You must have more knowledge than just simply take idea and code it in basic dialect. Why people don't learn ASM for controllers?
Reading the datasheet isn't something that I've suggested anywhere in the documentation, probably should fix that! Not reading the datasheet is a pretty common mistake for beginners, it's something that someone who isn't from an electronic background probably wouldn't have any idea to do.
People don't learn assembly straight away because it's harder to use. I think it's better for people to use a high level language at first, and gradually become familiar with working with microcontrollers. Once they know more about the microcontroller and general programming principles, then they can learn assembly if they need to do something that can't be done in an HLL. Of course, I don't think there are any compiler authors out there who'd recommend assembly!