If I correctly understand your code (i'm not very familiar with C), then Pyastra equivalent would be:
TRISD = 0
PORTD = fbin('1111 1111')
PORTD[4] = 1
The first line doesn't require any comments. The second line sets all the port D bits to "1". fbin pseudo function denotes binary data. Third line sets bit 4 of port D. The infinite loop is set by Pyastra automatically at the end of any program.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
like translate the following code to Pyastra. Pardon by my English
# // ----- PORTD bits --------------------
# typedef union {
# struct {
# unsigned char :1;
# unsigned char :1;
# unsigned char :1;
# unsigned char :1;
# unsigned char LED0:1;
# unsigned char :1;
# unsigned char :1;
# unsigned char :1;
# };
# } __PORTD_bits_t;
# extern volatile __PORTD_bits_t __at(PORTD_ADDR) PORTD_bits;
#
# #define LED0 PORTD_bits.LED0
#
# void main()
# {
# TRISD = 0;
# LED0 = 1; //this line doesnt work...
#
# while(1) {};
# }
If I correctly understand your code (i'm not very familiar with C), then Pyastra equivalent would be:
TRISD = 0
PORTD = fbin('1111 1111')
PORTD[4] = 1
The first line doesn't require any comments. The second line sets all the port D bits to "1". fbin pseudo function denotes binary data. Third line sets bit 4 of port D. The infinite loop is set by Pyastra automatically at the end of any program.